SETPOS

Synopsis
SETPOS position
Description

Moves the turtle to an absolute X,Y coordinate. The position input is a list of two numbers, the X and Y coordinates.

There is often some confusion on how to call SETPOS with variables. Let's look at some code:

MAKE "x 0
MAKE "y 100
SETPOS [:x :y]      ; fails
SETPOS (list :x :y) ; works

The first case is a list that contains 2 words ":x and ":y. In the second case a list is constructed containing the value of :x and :y.

You can see this more clearly by using SHOW:

show [:x :y]
[:x :y]
SHOW (LIST :x :y)
[0 100]

Example
; draw a square
CLEARSCREEN
SETPOS [0 100]
SETPOS [100 100]
SETPOS [100 0]
SETPOS [0 0]
See Also
POS
SETX
SETY

SourceForge.net Logo