An actor can move in different directions. First you need to know how angles are interpreted in Miniworldmaker. Angles are independent of the orientation of the character:
0° means a movement upwards.
90° means a movement to the right..
180° oder - 180° means a movement downwards.
-90° means a movement to the right.
The interpretation of directions corresponds to the popular programming language Scratch, see https://en.scratch-wiki.info/wiki/Direction_(value)
There is one exception: The default direction in Miniworldmaker is 0°, i.e. tokens point upwards.
Angles as Strings¶
Some angle sizes can also be called strings:
right”: is equivalent to 0°.
“up” is equivalent to 90°.
“left” is equivalent to 180°.
Down is equivalent to 270 degrees.
A special specification is “forward”: In contrast to the other specifications, “forward” means in the direction of the figure’s gaze. In the picture above “forward” corresponds to 0°, because the actor looks to the right.
Methods and Attributs¶
You can use the following functions to change the alignment of an actor:
Sets the direction directly.
Sets direction the token is oriented
0°: East, x degrees clock-wise otherwise You can also set the direction by String (“forward”, “up”, “down”, …
Moving in rpg-basic-example.py:
>>> def on_key_down(self, keys): >>> if "W" in keys: >>> self.point_in_direction("up") >>> elif "S" in keys: >>> self.point_in_direction("down") >>> elif "A" in keys: >>> self.point_in_direction("left") >>> elif "D" in keys: >>> self.point_in_direction("right") >>> self.move()
Turns the actor in left direction.
Turns the actor in right direction.
The actor rotates 180°. The figure is mirrored so that the actor is not upside down after the rotation.