Height simulation in isometric tilemap

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

My game has three types of tiles with colliders: pits/flat obstacles, half-height obstacles, and full-height obstacles. The bullets shot by the character are supposed to go over the half-height obstacles, unless he shot fired them while crouching. I’ve implemented this by having three separate tilemaps. One for ground and pits (with collision layer 1), one for everything that protrudes over the ground (CL 1 & 2), and a hidden one which repeats all the full-height tiles (CL 1, 2, & 3).

Basically, layer 1 is for player collision and the other two are for two bullet heights. When it comes to collision detection, it works like a charm. But I don’t know how to make the layer-3 bullets be drawn over the low obstacles without breaking the Y-sorting.

Screenshot

Any ideas?

:bust_in_silhouette: Reply From: mateusak

Use the Z coordinate under ‘Node2D > Z’.

Which Z? If I set the bullet’s Z to 1, it doesn’t get occluded by the tall block (and I want it to). Changing Z’s of the tile sprites does nothing.
enter image description here

Ishari | 2018-01-11 21:23

Change your testBullet’s Z to 1 and your HighTiles’s Z to 2 (not the individual sprites, the actual TileMap node)

mateusak | 2018-01-12 19:57

Then I get this monstrosity:
enter image description here

Unless I hide the HighTiles or set the LowTiles’ Z to 2 too. But that brings me back to square one.

Ishari | 2018-01-12 20:19

I’m pretty sure that would be solved by an YSort node. Create it and put both LowTiles and HighTiles nodes inside it.

mateusak | 2018-01-12 20:25

No, it would mess things up even more. But this should work: keep all Zs at the default 0, but when a bullet flies over a low tile, its Z temporarily changes to 1. Thanks!

Ishari | 2018-01-12 21:45