[MWForum]Re: moving turtles at the same time

mwforum@lists.mathcats.com mwforum@lists.mathcats.com
Fri, 31 Oct 2003 20:56:59 -0800


I never use the FOREVER command but instead prefer to write a procedure 
for each turtle I want moving, put the name of the procedure into the 
turtle instruction line, and then use the CLICKON command to activate 
each turtle.  For instance,  if I want 3 birds to fly across the screen 
at different speeds and disappear at the edge of the screen I would 
write a separate procedure for each bird.

TO FLY1
TALKTO "T1
REPEAT 100[SETSH 9 FD 3 WAIT .5 SETSH 10 FD 3 WAIT .5]
HT
END

TO FLY2
TALKTO "T2
REPEAT 150[SETSH 9 FD 2 WAIT .5 SETSH 10 FD 2 WAIT .5]
HT
END

TO FLY3
TALKTO "T3
REPEAT 300[SETSH 9 FD 3 WAIT 1 SETSH 10 FD 1 WAIT 1]
HT
END

I would have a START or STARTUP procedure (depending on whether I want 
it to start automatically or manually),  that would set the position, 
heading, shape of each turtle (bird) and then start each with the 
CLICKON command.

TALKTO "T1 CLICKON
TALKTO "T2 CLICKON
TALKTO "T3 CLICKON

That would make all three birds fly at the same time.  It seems to me 
that I have more control of the action when using the CLICKON command.  
Are there advantages  of using FOREVER or disadvantages of using 
CLICKON that I don't see?

-John


On Friday, October 31, 2003, at 08:14 AM, Daniel Ajoy wrote:

> On 31 Oct 2003 at 8:21, Ask an Expert - Question wrote:
>
>> how do u get turtles moving at the same time using the
>> procedures page
>
> This procedure is an example:
>
> to movemany
> forever [t1, repeat 360 [fd 1 rt 1]]
> forever [t2, fd 1]
> forever [t3, repeat 360 [fd 1 lt 1]]
> end
>
> It is demonstrated in the project attached.
>
>
> Daniel
> OpenWorld Learning
>
>
> <MoveMany.mw2>
John St. Clair				Global SchoolNet Foundation
john.stclair@verizon.net		www.gsn.org
Vina Danks Middle School	LogoForum moderator
Teacher of Logo and Lego	groups.yahoo.com/group/logoforum