JSON data of tiles in a map

(The Mnk) #1

Hello, I want to read the JSON file exported by tiled.
I need to know what field or property indicates if a tile is rotated and in which angle and direction (horizontal / vertical) is rotated ?.

I have seen this but I can not find what I am looking for:

(Thorbjørn Lindeijer) #2

The global tile IDs stored in the JSON format are the same as for the TMX format. You can read up on global tile IDs here:


There is no explicit rotation bit, but from the three flipping bits you could derive the rotation if you need it (just note that the tile isn’t only rotated, but may also be flipped).

(The Mnk) #3

Hello, thanks for the information.
Please, I have a misunderstanding with this information:
bit 30 indicates whether the tile is flipped (anti) diagonally, enabling tile rotation.

What does it mean? What should I do if that bit is 1?
Should I rotate the tile 90 degrees?

Sin título-1

(Thorbjørn Lindeijer) #4

No, it’s a plain flip, but along the diagonal:


So it swaps the X and Y axis of the image. It is the same as “horizontal flip + rotate 90 counter-clockwise” or “vertical flip + rotate 90”.