SETTURTLEindex
(SETTURTLEindex
hasownpen
)
Selects turtle index
for control.
If the turtle was not previously activated, then all turtles from zero to index
are activated.
From now until you select a different turtle, all turtle commands refers to the newly selected turtle.
Normally, all turtles share the same PENMODE, PENSIZE and PENCOLOR.
However, if you supply the optional boolean hasownpen
input as "true
, then the selected turtle, as well as all newly activated turtles, have their own PENMODE, PENSIZE, and PENCOLOR.
You also can change a previously activated turtle to use its own pen (or not) by specifying a hasownpen
input.
If no hasownpen
input is given and SETTURTLE does not activate any new turtles, then the selected turtle's pen remains unchanged.
If no hasownpen
input is given and SETTURTLE activates a new turtle, then the new turtle uses the shared pen (the one that FMSLogo initally gave to turtle 0 when it started).
An example in 2D:
REPEAT 8 [SETTURTLE REPCOUNT RIGHT REPCOUNT*30 FORWARD 20*REPCOUNT]
An example in 3D that draws a cube from the default vantage point:
PERSPECTIVE
CLEARSCREEN
REPEAT 4 [REPEAT 4 [FORWARD 100 RIGHT 90] FORWARD 100 DOWNPITCH 90]
An example in 3D that uses SETTURTLE to draw the same cube from a different vantage point:
PERSPECTIVE
CLEARSCREEN
SETTURTLE -1 ; Select the "eye position" turtle
SETXYZ 500 500 500 ; Move the vantage point
; Draw a cube from the new vantage point.
SETTURTLE 0
REPEAT 4 [REPEAT 4 [FORWARD 100 RIGHT 90] FORWARD 100 DOWNPITCH 90]
TURTLE |
TURTLES |