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

Depth Issue

G

gaz_d

Guest
GameMaker Studio 2 IDE v2.0.7.171 Runtime v2.0.7.110

My game is a top down 2.5D My player has up, down, left and right sprites My player holds a gun which is a seperate object. In the step event for the gun object, I have always had this code;

if obj_player.sprite_index = spr_player_up{
depth = obj_player.depth+1;
}else{
depth = obj_player.depth-1;
}

This has meant the gun is always drawn over the player except when he is facing up and the gun is then drawn beneath him as it should be.

After porting the project to GameMaker Studio 2, I notice the sprites are as they should be except when I go into a cave(new room), then back into the original room(it's persistent), the gun is drawn over the player sprite no matter what, despite the depth check in the step event?

Both the Player and the Gun are persistent objects.
The player is created in the 1st room in the room editor on a layer with a depth of 0
The gun is created in the second room on a layer with a depth of 0

Sorry if this is dumb. I am reading through as much as I can but am struggling with the switch from GameMaker 1.4 to 2. Thanks in advance for any help!
 
Top