• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GML How to get a backgrounds Y value programatically?

murchie85

Member
[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.


Hello,

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.

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

Attachments

Last edited:
Top