How can I made a good RPG Map with Tilemap/Tileset ?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By mbenoni
:warning: Old Version Published before Godot 3 was released.

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 :

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.

The Demos and examples found here
Download - Godot Engine

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

guppy42 | 2017-06-09 12:33

Thank you for this link !

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

mbenoni | 2017-06-09 13:43

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

greynes | 2017-08-26 10:16