Tiled IDs should start at 1?

Very slight feature/bug?

Tile IDs are currently starting at 0, so lets say I place the first tile in my tileset down(currently has the ID of 0). When I open text editor, it would say it has the value of 1 i.e[0,0,0,1, 0].

Shouldn’t the tile ID number match its 2D array counter part?

Not necessarily, Tiled uses 0 to represent empty space since the first three most significant bits in the tile ID are used to store orientation flags. Negative values correspond to positive tile IDs once the flags are cleared, so using a negative value to represent empty space to allow IDs to match up with indices wouldn’t make sense.

The TMX file documentation has more information on how to handle the flags if you’re interested.

1 Like