GML How to get a backgrounds Y value programatically?


[SOLVED] [EDIT] I found it by working through layer functions then got to layer_get_y in the documentation, I can set it with layer_y.


In the simple example below, I wish to get a given backgrounds Y value programatically, so I can change the sprite when it's out the screen and move it up top. So far I have worked out how to change the sprite as shown below, but the closest i have come to obtaining the Y value is background_y from the documentation, although it's confusing as an example it gives to modify a position
background_y[0] = view_yview[0]-50; is hard to follow, i'm guessing this is depreciated as i can't get them to work they show up as blue and not system variables.

myBackgroundOneID = layer_background_get_id("secondBackground")
layer_background_sprite(myBackgroundOneID, bGrass);
Many thanks


Last edited: