Array files are one number off from tile set

Hi there

I’ve been playing around with the map editor as it’s easier than my regular tilemap editor plus I can print out the integer arrays.

The problem is that when ever a export my map as a text file like .json the integers are always 1 off. For instance tile number 0 shows up as 1 and 1 shows up as 2 and so on.

It’s weird because in the app and clicking on tile properties it tells you that tile number 0 should be labeled tile 0.

Is there a way to fix it so it shows tile numbers in the order that they are listed.

The integers you see on the tile layers are global tile IDs, which can span several tilesets and can also be 0 (which means no tile). The first tile of the first tileset always has the global tile ID 1, which is why they appear off by one.

For each tileset, you can find the global tile ID of its first tile as the firstgid property. This allows you to look up which tileset a certain tile belongs to, and to calculate its local tile ID by subtracting the firstgid value from the global tile ID. This is covered by the documentation for the TMX Map Format. Note that the global tile IDs can also contain flags that indicate whether the tile should be flipped.