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

SOLVED How do I do this effect?

K

KevonLemon

Guest
I want when my character is behind a sprite it stays in front and when it is in front it stays behind

1610565642997.png1610565660909.png
 
Last edited by a moderator:

Umaro

Member
A basic way to do it is "depth = -y", though it depends on whether you're using depth or layers for your project.
 

FoxyOfJungle

Kazan Games
A basic way to do it is "depth = -y", though it depends on whether you're using depth or layers for your project.
By using depth = -y, you are telling GMS 2 to create multiple layers for each instance that is inserted at such depth, which is very inefficient (like when you have a lot of instances, for example), although it works, I do not recommend doing this.

What you should do is find a way to, without using many layers (like depth = -y), separate the depth from the instances (automatic depth sorting), there are some tutorials that can help you, like this for example:


 

Umaro

Member
As far as I know, from what people have tested, depth = -y doesn't cause any significant slowdown in GMS2.
 
Top