0
\$\begingroup\$

I am currently working on a game using XNA and Tiled. I use Tiled to create my maps and load them using TiledSharp. Some of my maps have tiles that are rotated by using one or more of the left rotate, right rotate, horizontal flip, vertical flip options in combination.

In the tiled documentation, it shows there are certain ways to find out if an object is horizontally, vertically, or diagonally flipped. TiledSharp tells me this information. However, I don't know what to do if a tile is diagonally flipped. How many degrees should I rotate the tile (in multiples of 90 degrees)?

\$\endgroup\$
0
\$\begingroup\$

A diagonal flip in Tiled essentially swaps the X and Y axis of the tile (it flips along the line x=y, also called a transpose). For square tiles, this is easy to implement by swapping the corner vertices of the quad.

If you need to use flipping and rotation to implement the rendering then a diagonal flip is the same as a 90-degree rotation clockwise followed by a horizontal flip (or a 90-degree rotation counterclockwise followed by a vertical flip).

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.