Set turtle's position

setpos xy

Moves a turtle to the new position specified as 2-element array or list xy. If turtle's pen is down, then the turtle draws a line.

Example:

pu
setxy 100 0
pd

setpc "blue
repeat 10 [
  setpos array
  100 * cos 40 * (repcount-1)
  100 * sin 40 * (repcount-1)
]

setpc "orange
repeat 10 [
  setx 100 * cos 40 * (repcount-1)
  sety 100 * sin 40 * (repcount-1)
]

Output: a drawing in the graphics window.

See also:

Table of Content