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

GameMaker Referencing drawn layers

Okay so is it possible (and if so how to go about it properly) to draw sprite items and then reference or move them individually in game when something happens? For example, lets say I have this...

Code:
draw_sprite(info here); // top layer
draw_sprite(info here); // mid layer
draw_sprite(info here); // bot layer
could I then nest each "layer" in a temporary variable and then change their x or y position later when something happens?

Code:
var _topLayer = draw_sprite(info here); // top layer
var _midLayer = draw_sprite(info here); // mid layer
var _botLayer = draw_sprite(info here); // bot layer

if place_meeting(x,y,oPlayer) {
    _topLayer.x = x-20;
}
 
Top