SOLVED How do I do this effect?

KevonLemon

Member
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:

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