# Aligning “Can Rotate” to game rules

**URL:** <https://forum.vassalengine.org/t/aligning-can-rotate-to-game-rules/72843>\
**Category:** Module Design\
**Tags:** tutorial\
**Created:** [October 23, 2021, 10:18am UTC](https://forum.vassalengine.org/t/aligning-can-rotate-to-game-rules/72843 "2021-10-23T10:18:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![marktb1961](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/marktb1961/32/231_2.png) [@marktb1961](https://forum.vassalengine.org/u/marktb1961)\
**Post date:** [October 23, 2021, 10:18am UTC](https://forum.vassalengine.org/t/aligning-can-rotate-to-game-rules/72843/1 "2021-10-23T10:18:09Z")

</div>

**Problem**  
A typical piece in a hex and counter game will have a _Can Rotate_ trait defined with 6 facings. This works fine where the map and game rules align to Vassal’s set Facings, i.e. facing 1 is the north-facing side. Where the game alignment is offset from Vassal’s, the _Can Rotate_ trait will need to be defined with 12 facings; if the game piece only has 6 facing sides, this will mean that players need to rotate the piece twice for each facing.

For example, on the Montmirail map in [Jours De Gloire: Montmirail and Vauchamps 1814](https://vassalengine.org/wiki/Module:Montmirail_and_Vauchamps_1814) the north-facing side is a flat edge but in this game, unit counters must face to a vertex:

 ![Pasted Graphic 2](https://forum.vassalengine.org/uploads/default/original/2X/e/ed9c8a9092919f2d171547560bf1dea7fb8de91c.png)  
In Vassal terms, the counters in this picture are aligned to facing 11 but in game terms this is one of only 6 allowed facings.

**Solution**  
To make a this type of hex grid operate as six-sided _ **and** _ vertex-aligned, use Trigger traits to “bump” each rotation step onto the next vertex. The benefit of this is that the user will only need to perform one rotation command for each facing change in the game, rather than two.

i) The Can Rotate trait is defined with 12 facings, as before  
ii) For both Rotation commands (Clockwise and Counter-Clockwise), define a Trigger that actions an additional Rotation. The counter will be created aligned to Vassal facing 1, so put the following condition in the _Trigger when properties match_ field so that the counter will not bump an extra step if it is starting on an edge facing:

> {_Rotate_\_Facing % 2 == 1}

(_Rotate_ is the Rotator name, as defined by you in the Can Rotate trait. The condition is true when the Facing is an odd number).

**Configuring for different map types**  
If you have maps with different hex grid orientations in the same module, you could define a map level global property so that the same rotation commands will work in either type of map. Adapting the previous example, dFace would be the map global property set to 0 or 1 depending on the hex orientation of the map:

> {_Rotate_\_Facing % 2 == dFace}

This solution can be further tailored to allow exceptions to the alignment. For example, the following Trigger condition evolved from the previous example to allow counters to be aligned vertically as well as to any vertex:

 ![Also watch for these Key Commands](https://forum.vassalengine.org/uploads/default/original/2X/2/205791700da933aeda15cf88979503a1c156fe78.png)

**Vassal v3.6**  
[Vassal v3.6](https://vassalengine.org/wiki/VASSAL_3.6_Release_Notes#Major_New_Features) provides a more efficient solution via “Rotate direct to a facing” feature. Facing calculation/property can be entered directly in the Can Rotate trait, doing away with the need for a Trigger.

 ![image](https://forum.vassalengine.org/uploads/default/original/2X/2/2e5fb981c90ec979fc28ed6d3aecea98e816cfeb.png)
