Tiled Map Editor and Z-indexing

Is there a way to manually set the z value of a layer in Tiled before exporting the map out to a Defold .tilemap?

1 Like

Adding a “z” custom property to the tile layer doesn’t seem to do anything, whether using the defold or defoldcollection export format. The collection export just automatically generates z values like it usually does.

Would it be possible to instead take a Tiled json map, put that in a Defold project, decode the json data, and then use it to write a .tilemap file via io.* functions so I can use a custom property for z-indexing? Would that even save time in the long-run, compared to just setting up the layers’ z values in the Defold editor after editing a map in Tiled?

1 Like

I was wondering the same thing the other day. I spent some time investigating this, and I see that one can set the “Tile Layer Format” for the map to CSV. This should reduce the effort w/ making an importer tool for Defold (since no base64 decompression is required.) However, I spent a couple hours trying to hack a script in Python 3 together assuming base64 was necessary before I found this option so I’ll try again later.

2 Likes

Hey, I created a Python3 script which allows me to convert tiled maps in CSV format into defold ones (as long as infinite is unchecked and the map doesn’t split the data into chunks.) It still needs a lot of work but it at least accomplishes the requirements of my own project for now. Here’s the code if it’s of any use :slight_smile:

EDIT: Link to separate thread for the script related updates: Tiled tmx (CSV non-infinite) map converter tool

3 Likes