Isometric Tilemap and YSort problem

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Dzandaa

I started designing of an isometric dungeon game.

I have a problem because the player sometimes appears through the walls.

I tried to change the setting “Tile Origin” but then the problem moves to another side.

I think of an YSort problem

Main Scene
Node2D
—>TileMap # Grounds ZIndex 0 TileOrigin Centered Isometric 256x128
—>TileMap # Walls ZIndex 1 TileOrigin Centered Isometric 256x128
------>YSort
--------->Player # Zindex 0 Z As Relative

And Scene Player

KinematicBody2D
—>AnimatedSprite
—>CollisionShape2D
—>Camera2D

Any idea?

:bust_in_silhouette: Reply From: Omar13

I had some problems (2D platformer) using YSort + Node (Node for container… Enemies for example, and inside that Node every enemy). The YSort breaks

My approach was make an excel with “node” “z index” for memory and ZIndex calculations, and not touching any YSort on Godot, just managing ZIndex
So… for example

Tilemap World → -100 ZIndex
Player → 100 ZIndex
Enemy → 50 ZIndex
Objects → 20 ZIndex

and so…

The “big” values are in case I need to add something between

Not ideal but works for me

Of course this can be a mess with relative ZIndex and calculation if you dont get track of values (in my case that excel is mandatory for this).