# How do I get the my hud's x and y

Just started using Construct 2? Post your questions here

### » Thu Aug 13, 2015 10:51 pm

Edited:
how do I return my huds X and Y in a textbox
I tried "X: " & hud.X
but it doesn't update it just is 0 all the time
and yes its in a every tick event

Edit2: I want to return my huds origin points x and y in the layout
not the layer and not the screen
B
14
S
6
G
1
Posts: 150
Reputation: 1,987

### » Sat Aug 15, 2015 9:13 am

If you hud-object is on a layer without paralax it's coordinates will stay the same..

Maybe you can get what you want using these expressions:

CanvasToLayerX(layer, x, y)
CanvasToLayerY(layer, x, y)
Calculate the layout co-ordinates underneath a position in canvas co-ordinates for a given layer.

LayerToCanvasX(layer, x, y)
LayerToCanvasY(layer, x, y)
Calculate the canvas co-ordinates above a position in layout co-ordinates for a given layer.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

### » Sat Aug 15, 2015 9:58 pm

LittleStain wrote:If you hud-object is on a layer without paralax it's coordinates will stay the same..

Maybe you can get what you want using these expressions:

CanvasToLayerX(layer, x, y)
CanvasToLayerY(layer, x, y)
Calculate the layout co-ordinates underneath a position in canvas co-ordinates for a given layer.

LayerToCanvasX(layer, x, y)
LayerToCanvasY(layer, x, y)
Calculate the canvas co-ordinates above a position in layout co-ordinates for a given layer.

ya in most spots of the layout these return null or -
bug maybe?

Edit: LittleStain

I think this is a bug but I am using r206 and r211
I removed the ("HUD X: " &) from ("HUD X: " & CanvasToLayerX(0,hud.X,hud.Y)) and it started returning the correct values

Edit2: ok so it must of been something with my project getting the null and -
but these functions still do not return the correct values
they seem to have different offsets depending on where i put my hud in my room

for example
my huds origin is 0,0 on the sprite so I need it to always return 0,0 when my hud is at the top left of the room

B
14
S
6
G
1
Posts: 150
Reputation: 1,987

### » Mon Feb 08, 2016 7:47 pm

@Shadowblitz16 did you find a solution?
B
42
S
6
G
1
Posts: 322
Reputation: 3,075

### » Mon Mar 14, 2016 1:10 am

sorry I've been away from these forums for a while I don't even have the project I was working on anymore
however If I run into this problem again I will let you guys know
B
14
S
6
G
1
Posts: 150
Reputation: 1,987