Set turtle's heading to its move direction

alignh

Sets the turtle's heading to its move direction (movedir). Note: instructions forward step and back step are changing the turtle's move direction to heading.

Example:

repeat 8 [
  "h := 45 * repcount ;direction of the vector
  "v := array cos :h-90 cos :h
  (print :h :v)
  setmovedir :v
  move 50
  wait 250
  alignh
  wait 250
]

Output:

45 {0.707106781186548 0.707106781186548}
90 {1 6.12303176911189E-17}
135 {0.707106781186548 -0.707106781186547}
180 {6.12303176911189E-17 -1}
225 {-0.707106781186547 -0.707106781186548}
270 {-1 -1.83690953073357E-16}
315 {-0.707106781186548 0.707106781186547}
360 {-1.83690953073357E-16 1}

See also:

Table of Content