Tilemap layers with different depth

Hello! I’m pretty new to defold and I was wondering if I can accomplish my player going over some parts of my tileset and under others. I saw that the layers can have different Z assuming that means depth, I changed that to above my player and nothing change, I assume its because the tileset is apart of a gameobject that has a z lower then my players but I dont exactly want to make my player a child of the tileset as I feel that might cause problems in itself.

All layers in a tilemap are currently drawn together, meaning that you cannot interleave tile layers and sprites. This is a reported issue.

A workaround is to use several tilemaps, not layers.

1 Like

Dang. do you have an idea when it might be fixed? I can work on other things until that happens if so.

It’s been like that for years but it’s something we’d like to change. There are workarounds such as drawing everything in two layers, then using the same tilemap twice and in one instance clearing the front layer and in the second the back layer at runtime.

well rip, if you could link me to a example of that I would appreciate it.

I created an example here: publicexamples/examples/tilemap_layers at master · britzl/publicexamples · GitHub

The interesting piece of code to clear a tilemap layer is here: publicexamples/examples/tilemap_layers/tilemap_layers/level.script at master · britzl/publicexamples · GitHub

Demo: Tilemap Layers 0.0

3 Likes