## VASSAL Reference Manual

Home > Module > Game Piece Palette > Game Piece > Can Rotate

### Can Rotate

This trait allows a piece to be rotated through an arbitrary number of facings. You can choose the number of valid facings. For example, a hex-based game may have 6 (or possibly 12) possible facings, while a game with a square grid game might have 4 or 8.

Alternatively, you can allow any arbitrary facing. In this case, selecting the Rotate command will change the cursor and let the user drag the cursor to select the facing of the piece interactively.

An optional additional command will rotate the piece to a random facing (in one of the valid facings, if applicable).

Note | The Can Rotate trait will rotate only those traits that appear above it in the list of traits for a Game Piece. Traits below the "Can Rotate" trait will be drawn on top of the rotated image.

Note

Since the rotations are created on the fly from a bitmapped image, the image quality of a rotated counter may be lower than the unrotated version. Alternatively, you may get better image quality for your rotations by creating separate images for each rotation in an external paint program (If your images are based on vector objects, you can rotate them without degrading quality) and putting them into different levels of a Layer.

Description:

  A short description of this trait for your own reference.

Rotator name:

  A name that is used to define the names of the properties that expose the internal state of this rotation trait.

  Note | It is advisable to avoid including spaces or other special characters in this field.

Allow arbitrary rotations:

  Check the box to enable arbitrary rotation instead of rotation through a fixed number of facings.

Number of allowed facings:

  Number of facings if fixed facings selected.

Rotate clockwise:

  The Menu text and Keystroke or Named Command to rotate clockwise through fixed facings if fixed facings selected.

Rotate counter clockwise:

  The Menu text and Keystroke or Named Command to rotate counter clockwise through fixed facings if fixed facings selected.

Rotate randomly:

  The Menu text and Keystroke or Named Command to select a random rotation.

Rotate directly:

  The Menu text and Keystroke or Named Command to rotate the counter to a specific facing, or a sepecific rotation in degrees.

Rotate direct to:

  An Expression that specifies which facing or position in degrees the Rotate directly Key Command will rotate the counter to.

  Note | Rotating to a degree position when a specific number of facings has been selected will cause the counter to rotate to the facing closest in Degrees to the requested position.

To Facing:

  A checkbox that is available when a specified number of facings are selected.

  When Checked, the Rotate direct to expression represents a facing number with 1 being the first facing, 2 the second facing etc. in a clockwise direction.

  When Unchecked, or when arbitrary rotations are selected, then the Rotate direct to expression represents the number of degrees clockwise from the 12 O’clock position to rotate the counter to.

A Can Rotate trait with 6 set facings

The same trait configured to rotate freely

#### Properties

A Can Rotate trait defines a number of Properties. In the name of the properties, <Rotator_name> is the Rotator Name specified in the trait configuration.

- <Rotator_name>_Facing returns the current facing if the number of facings is fixed. The value is an integer that ranges from 1 (the original, un-rotated state) to the number of allowed facings. For example, if the number of facings is 4, then this property returns a value from 1 to 4. Facing numbers increase in a clockwise direction.

- <Rotator_name>_Degrees returns the current rotation angle if arbitrary rotations are allowed. Rotation degrees increases in a clockwise direction.