transformable¶
- class Transformable¶
Implements a number of functions that allow the parent class to spatially transform its
entitiesandtileslists. All of the following methods operate in-place, meaning that the original positions and directions of every entity and tile are modified each time they are called.- flip(
- direction: 'horizontal' | 'vertical' =
'horizontal', Flip the blueprint across an axis, if possible. Flipping is done over the x or y axis, depeding on the input
direction.- Parameters:
- direction: 'horizontal' | 'vertical' =
'horizontal'¶ The direction to flip by; either
"horizontal"or"vertical"
- direction: 'horizontal' | 'vertical' =
- rotate(angle: int)¶
Rotate the blueprint by
angle, if possible. Operates the same as pressing ‘r’ with a blueprint selected.angleis specified in terms of Direction enum, meaning that a rotation of 4 is 90 degrees clockwise.Because eight-way rotatable entities exist in a weird gray area, this function behaves like the feature in-game and only rotates on 90 degree intervals. Attempting to rotate the blueprint an odd amount raises an
RotationError.- Parameters:
- angle: int¶
The angle to rotate the blueprint by.
- Raises:
RotationError – If the rotation is attempted with an odd value.