SETTURTLE

Synopsis
SETTURTLE index
(SETTURTLE index hasownpen)
Description

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 turtle's initial pen uses the initial pen that FMSLogo uses.

Example
; 2D Example
REPEAT 8 [SETTURTLE REPCOUNT-1 FORWARD 10*REPCOUNT]
; 3D Example
PERSPECTIVE
CLEARSCREEN
; Draw a cube from the default vantage point
REPEAT 4 [REPEAT 4 [FORWARD 100 RIGHT 90] FORWARD 100 DOWNPITCH 90]
; 3D Example with moving eye
PERSPECTIVE
CLEARSCREEN
SETTURTLE -1 ; select the "eye position" turtle
SETXYZ 500 500 500
SETTURTLE 0
; Draw a cube from a new vantage point
REPEAT 4 [REPEAT 4 [FORWARD 100 RIGHT 90] FORWARD 100 DOWNPITCH 90]
See Also
TURTLE
TURTLES

SourceForge.net Logo