Update: the library is now hosted on GitHub: https://github.com/zachmu/tiled-xna
I’ve had very good luck with Tiled Map Editor and the very simple XNA library I found to work with it, written by Kevin Gadd and Stephen Belanger. I’ve since tweaked the hell out of it to work with my own game engine, but it never needed any major overhauls until I started using a tile set creation tool called Pyxel Edit. Pyxel Edit is great for making quick mockups of a tileset (although it desperately needs a selection tool), and it has a great feature where you can rotate a tile into whatever orientation you want. The only issue is that the tile sheets it exports don’t contain duplicate rotated tiles for each orientation you need, so I thought that I couldn’t easily use it with Tiled, because you can’t rotate tiles in Tiled.
Except you can rotate tiles in the latest version of Tiled, even if there’s no UI for it. But it works as advertised. Pushing Z will rotate a tile, while X and Y mirror the tile horizontally or vertically.
Once I figured this out, I just needed to add support for it to the above XNA library. I found the TMX Map Format documentation to be very useful in this process, especially since it contained pseudo code examples. And I got to write some bit-masking code, which I always enjoy.
// Bits on the far end of the 32-bit global tile ID are used for tile flags const unsigned FLIPPED_HORIZONTALLY_FLAG = 0x80000000; const unsigned FLIPPED_VERTICALLY_FLAG = 0x40000000; const unsigned FLIPPED_DIAGONALLY_FLAG = 0x20000000;
Since this was a bit tricky to get right, especially the drawing, I figured I should share it back. So here it is: a simple XNA Tiled library with support for flipping and rotating tiles. Enjoy!