0 votes

Hello !

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 :

enter image description here

But when I use my Character, he's always displayed BEFORE the sprite of the map, as can be seen below :

enter image description here
(here it's good, cause Char is in front of, in perspective)

enter image description here
(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.

asked Jun 9, 2017 in Engine by mbenoni (41 points)

The Demos and examples found here
https://godotengine.org/download

Contains a demo ( /Godot-Demos-2.1.3-stable/2d/isometric_light/ ) that shows this, I think studying that would be quite helpful to you

Thank you for this link !

I've understood what didn't worked in my project with that =p

Could you please post how you solved the problem? I am stuck at the same point and do not understand the demo code. Thanks!

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.