So, I’m making my game with the Top-Down-RPG template, and something I did was copy the NPC and edit it. I now have NPC And NPC2. So when I stand right in front of the first NPC, the player appears above the NPC, as they should.
It works! Not for long, because when the player stands in front of NPC2, this happens:
Yeeeaaahhh I need some help…
I think this is happening beacause of the Z-order of the objects:
If the Z-order of an object is higher than the Z-order of the others, it will appear in fornt of them.
More info here: Add a background objects [GDevelop wiki]
Z-ordering in editor could help but generally when doing a top down game, best to edit the objects z-ordering through code or with an extension.
*You can use the extension Y-Sort:
The best way to make it work is by editing the points of the object to around the middle or bottom of the sprite.
*Or, you can edit the Z-ordering of the objects the way GDevelop presented in this video, through code rather than through an extension:
I tried the first two things that you said and it’s still occurring.
For this the extension to work:
- you’d need the player to also have y-sort behavior as well as all objects the need z-ordering the game.
For changing it in code:
- You’d need have everything in the scene the needs z-ordering into a object group and change it in code like how GDevelop did it in the video example.
Just like y-sort, It includes players, trees, any other objects that need z-ordering in the game.
If you are still having problem, feel free to take a screenshot of your events and we can review further c: