I'm currently working on an RPG (to be more accurate, I test some things), and I have the following problem:
- I need to do an RPG Map with some elements
- Some elements need to have collisions
- I want my character to be displayed behind or in front of the elements, depending of the "depth perspective".
... and I don't know how to do this.
I've tried to use a Tilemap/Tileset to craft the map. It appends that all elements are displayed well INSIDE the Tilemap, as can be seen :
But when I use my Character, he's always displayed BEFORE the sprite of the map, as can be seen below :
(here it's good, cause Char is in front of, in perspective)
(here it's bad, cause Char is displayed in front of, but is BEHIND in perspective)
I've tried to play with the z-relative coordinate of my char or my map, but I don't find a solution. It seems I can't play with the z-relative cell by cell either. Can I have any help on this ?
PS: My char is a separated KinematicBody2D, with a sprite and a CollisionShape2D.
My Tilemap is made of Sprite with StaticBody2D and CollisionShape2D as children.
I add my map and my char in a Node2D scene, their respective z coordinates are relative to parent.