Set turtle's move direction
setmovedir vector
Sets the new direction of a turtle's moves according to the vector specified as a 2-element array or list.
This direction is used by the move
instruction. Turtle's move direction
is always a unit vector, however vector in the argument can be of any length.
Note: forward
and back
instructions change turtle's move direction to the current heading
value.
Example:
repeat 8 [
(print heading movedir)
setmovedir array cos heading-90 cos heading
move 30
rt 45
]
Output:
(also a drawing)
0 {0 1}
45 {6.12303176911189E-17 1}
90 {0.707106781186548 0.707106781186548}
135 {1 6.12303176911189E-17}
180 {0.707106781186548 -0.707106781186547}
-135 {6.12303176911189E-17 -1}
-90 {-0.707106781186548 -0.707106781186547}
-45 {-1 6.12303176911189E-17}
See also:
Table of Content