The turtle sets its x-coordinate to x and its y-coordinate to y.
Equivalent to set xcor x set ycor y
, except it happens in one time step instead of two.
If x or y is outside the world, NetLogo will throw a runtime error, unless wrapping is turned on in the relevant dimensions. For example, with wrapping turned on in both dimensions and the default world size where min-pxcor = -16
, max-pxcor = 16
, min-pycor = -16
and max-pycor = 16
, asking a turtle to setxy 17 17
will move it to the center of patch (-16, -16).
setxy 0 0 ;; turtle moves to the middle of the center patch setxy random-xcor random-ycor ;; turtle moves to a random point setxy random-pxcor random-pycor ;; turtle moves to the center of a random patch
See also move-to.
Take me to the full NetLogo Dictionary