Hello, I am trying to figure out how to change the id’s of my exported array.
Say I have an array that looks like this:
data:[2,2,2,
2,1,2,
2,2,2]
How do I export the JSON so the data looks like this:
data:[1,1,1,
1,2,1,
1,1,1]
Also I have manually changed the tile ID’s in the .tsx file, and when I go back to the Tiled map editor the map looks inverted like I want. But when I export the JSON file, the data array does not change at all.
Would I have to create a new tileset, and then load the images into the editor in inverse order? There has to be some easy way to do this without doing so.
Many thanks.
If you change the tile IDs in the Tileset file, the map will just load the wrong tiles in each place. If you want to change the tile IDs in the Tileset and the map, you’ll need to replace all instance of tile 2 with 1, and of tile 1 with 2, and then you’ll get the export you want.
Generally though, tile IDs shouldn’t matter beyond just being a way to figure out which tile is used. This is why there are no built-in tools to change tile IDs like you want. You should really think about exactly why you need the IDs reversed, and whether your goals wouldn’t be better-accomplished by other means. If you really do need IDs reversed, you can switch the tiles around properly (instead of only half-way as you did before), or write a custom export format.
Thanks, this seems to have worked well.