0 Favourites

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

  • 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

  • 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.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • 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

    LittleStain plz reply

  • Shadowblitz16 did you find a solution?

  • 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

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
99 10,124
karshinkoff's avatar
karshinkoff
Unread hot topic
56 4,727
MPPlantOfficial's avatar
MPPlantOfficial
Unread hot topic
0 Favourites
Why is Stencyl doing better?
44 16,851
Potato's avatar
Potato