I have a map with a few layers. The background layer and a collisions layer are the most important.
The collisions layer is obviously mostly empty as there are a few platforms, floor etc for the player to stand on (its a vertical scroller) but those empty tiles are set to 0 in the JSON export. The problem is there is also a tile with an ID of 0, so its unable to differentiate between no tile, and the tile with ID 0.
I’m pretty new to Tiled and have been struggling to find an option where I can set “no tile” to something like -1 so I can differentiate. I would rather not change the tileset to begin with an ID of 1 if possible, though if this is the best solution im sure I can make it work Any support is gratefully received!
Global tile IDs (GIDs) found in maps and tileset-local IDs found in tilesets are different. GIDs begin at 1, with 0 being the empty tile. Tileset-local IDs begin at 0.
Every tileset listed in a map has a
firstgid property. You need to subtract this number from the GID to get the tileset-local ID. So, GID 0 means no tile, and GID 1 means the 0th tile in the first tileset (which will have
firstgid is also how you can tell which tile belongs to which tileset when you have multiple tilesets in a map. The tile belongs to the tileset that has the greatest
firstgid smaller than or equal to the GID you’re looking at.
Thanks so much - that makes sense, I just offset everything by one and treat 0 as ‘no tile’ and everything looks alot better