# Rotating square tiles by 90, 180, 270

**URL:** <https://discourse.mapeditor.org/t/rotating-square-tiles-by-90-180-270/230>\
**Category:** Suggestions\
**Created:** [February 8, 2015, 8:35pm UTC](https://discourse.mapeditor.org/t/rotating-square-tiles-by-90-180-270/230 "2015-02-08T20:35:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![GameCy](https://avatars.discourse-cdn.com/v4/letter/g/c0e974/32.png) [@GameCy](https://discourse.mapeditor.org/u/GameCy)\
**Post date:** [February 8, 2015, 8:35pm UTC](https://discourse.mapeditor.org/t/rotating-square-tiles-by-90-180-270/230/1 "2015-02-08T20:35:38Z")

</div>

When tiles are square, they can be rotated by 90, 180 or 270. This would avoid having to create the same tile 4 times in the tileset. This is particularly usefull when tiles are roads/paths etc.  
I know it is possible to rotate in the Objects layer, but the above feature request 🙂 is for the map layers.  
I understand this would require to store some property for each tile on the map, but maybe it could be stored as a rotation array for all the tiles in the Layer Properties?

Thanks

---

<div class="post-metadata">

**Author:** ![Ablu](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.mapeditor.org/ablu/32/1496_2.png) [@Ablu](https://discourse.mapeditor.org/u/Ablu)\
**Post date:** [February 8, 2015, 10:04pm UTC](https://discourse.mapeditor.org/t/rotating-square-tiles-by-90-180-270/230/2 "2015-02-08T22:04:19Z")

</div>

You can rotate / flip tiles too. I think the keys for that are `x`, `y` and `z`. But i am on the phone so I cannot check it at the moment…

---

<div class="post-metadata">

**Author:** ![bjorn](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.mapeditor.org/bjorn/32/1599_2.png) [@bjorn](https://discourse.mapeditor.org/u/bjorn)\
**Post date:** [February 9, 2015, 8:32am UTC](https://discourse.mapeditor.org/t/rotating-square-tiles-by-90-180-270/230/3 "2015-02-09T08:32:59Z")

</div>

Right, as @Ablu points out this feature is already there. The X and Y keys flip the current stamp on the respective axis, while Z and Shift+Z keys rotate it by 90 degrees in different directions. Flags are used for each cell to store whether the tile graphic should be flipped horizontally, vertically or diagonally.

---

<div class="post-metadata">

**Author:** ![GameCy](https://avatars.discourse-cdn.com/v4/letter/g/c0e974/32.png) [@GameCy](https://discourse.mapeditor.org/u/GameCy)\
**Post date:** [February 11, 2015, 7:39pm UTC](https://discourse.mapeditor.org/t/rotating-square-tiles-by-90-180-270/230/4 "2015-02-11T19:39:01Z")

</div>

Excelent!  
So the flags in the MSB (most significant byte) seem to be :  
0x80 - flip X  
0x40 - flip Y  
0x20 - flip diagonally

or in rotations (clockwise)  
0xA0 - 90 degrees  
0xC0 - 180 degrees  
0x60 - 270 degrees

thanks

---

<div class="post-metadata">

**Author:** ![Ablu](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.mapeditor.org/ablu/32/1496_2.png) [@Ablu](https://discourse.mapeditor.org/u/Ablu)\
**Post date:** [February 11, 2015, 8:09pm UTC](https://discourse.mapeditor.org/t/rotating-square-tiles-by-90-180-270/230/5 "2015-02-11T20:09:01Z")

</div>

Check the official documentation for this:

> **[bjorn/tiled](https://github.com/bjorn/tiled/wiki/TMX-Map-Format#tile-flipping)**
>
> A flexible level editor. Contribute to bjorn/tiled development by creating an account on GitHub.

Rotating is a combination of different flips, yes.

Regards,  
Ablu
