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

0 favourites
  • 5 posts
From the Asset Store
**** Racing game hud and user interface icons *****
  • 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

  • Try Construct 3

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

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

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