MicroWorlds


Controlling a Turtle's Movements

Turtles can be controlled using many of the same commands used in Logo.

Some of these commands are:

COMMAND

EXAMPLE

EXPLAINATION

setpos

setpos [-20 30]

sets the position of turtle

seth

seth 90

sets the turtle heading 0 is up
90 is right
180 down etc.

fd

fd 10

moves forward

bk

bk 5

moves back

wait

wait 5

waits a set time

rt

rt 90

right turn by an amount in °

lt

lt 180

left turn by an amount in °

st

st

show turtle

ht

ht

hide turtle

everyone

everyone,

all turtles

t1

t2,

talk to turtle listed

launch

launch [runbark]

launches a procedure

touching?

touching? "t1 "t2

reports true or false on whether the turtles listed are touching

when

when [touching? "t1 t2] [announce [Ouch]]

 

colourunder

when [colourunder = 15] [rt 180]

 

There are lots of other commands available and it is always possible to find these using Help

Task

 




Created by Geoff Adcock
Last Update: 22-Oct-2006