next up previous contents index
Next: Play music Up: List of primitives Previous: Break commands   Contents   Index

Multiturtle Mode

It's possible to have several active turtles on the screen. By default, on Xlogo startup, only one turtle is available. Its number is the 0. If you want to "create" a new turtle, you can use the primitive setturtle followed by the number of the turtle. To prevent from obstruction, the turtle is created on the origin and is invisible (you must use showturtle to show it). Then, the new turtle is the active turtle, it obeys to all classic primitives while you don't change active turtle with setturtle. The maximum number of available turtle can be set in menu Options - Preferences - Tab options.

Here are the primitives for the multiturtle mode:

Primitives Argumentss Utilisation
sturtle, setturtle a: number The turtle numero a is now the active turtle. By default on Xlogo startup the active turtle is the numero 0.
turtle none Returns the numero of the active turtle.
turtles none Returns a list which contains all the numero af the turtles actually on the screen.
killturtle a: number Kill the turtle number a
setTM, setturtlesmax integer Set the maximum number of turtles for multiturtle mode.
tm, turtlesmax none Returns the maximum number of turtles for multiturtle mode.


next up previous contents index
Next: Play music Up: List of primitives Previous: Break commands   Contents   Index
Loïc 2008-06-08