Hey everyone!
I need some help with tilemaps. I’m trying to create depth (sort of top down view) in my game but I don’t really know how to get the z-ordering to work inside the tilemap.
I noticed that there was a fix recently for this (Defold 1.2.161 has been released), but I just don’t understand how it works or what I should be doing. Worth noting is that I’m creating the map in tiled and exporting it to .tilemap
The fix in 1.2.161 was that tilemaps with multiple layers now can have sprites mixed in between layers. In older versions of Defold all layers of a tilemap were rendered together.
The tilemap component itself has one z-value and individual layers can be offset from the component z-value. The layers get sorted and rendered just like any other visual component and can end up in front of or behind other components based on the aggregated final z-value (taking into account hierarchies of game objects).
Another question, is there any way of setting the z value of a tile layer from code, alternative move tiles to different layers from code? Otherwise, what would be the best approach if I want to be able to move in front or behind tiles in the game?