Home
Project Folders
Teacher Resources
Student Resources
How Do I?
Literacy
MWForum
Site Map
Search
Our Team

MWForum Message [Date Index] [Threads] [Authors] [Attachments] [Subscribe]

[Thread Prev] [Thread Next]

To: mwforum@xxxxxxxxxxxxxxxxxxxxxxxxxxxx, Max <mnphilips@xxxxxxxxxxx>
Subject: Re: MIA, Ask an Expert: different position
From: "Daniel Ajoy" <da.ajoy@xxxxxxxxx>
Date: Mon, 16 Jul 2007 19:51:02 -0500
Dkim-signature: a=rsa-sha1; c=relaxed/relaxed;

> How do i make the second turtle go to a different place if 
> its random placement lands it right on top of the first 
> turtle?  Is there a way to use somewhat of a 'goto' and 
> 'label' combo?  I will write these in my code in quotes.
> 
> Here is my code: (xcoord and ycoord are text boxes)
> 
> to start
> t1, setpos [-257 -152]
> 'label 1'
> setxcoord random 18
> setycoord random 12
> setxcoord xcoord * 30
> setycoord ycoord * 30
> setxcoord 253 - xcoord
> setycoord 178 - ycoord
> t2, setpos (se xcoord ycoord)
> 'if touching? "t1 "t2 [goto 1]'
> end 
> 


maybe this:

to start
t1, setpos [-257 -152]
loop
end

to loop
setxcoord random 18
setycoord random 12
setxcoord xcoord * 30
setycoord ycoord * 30
setxcoord 253 - xcoord
setycoord 178 - ycoord
t2, setpos (se xcoord ycoord)
if touching? "t1 "t2 [loop]
end


Daniel
OpenWorld Learning



  • Previous by thread: Re: MIA, Ask an Expert
  • Next by thread: MIA, Ask an Expert

  • To save an attachment to your computer, PC users should right-click (Mac users, click and hold the mouse button) on the link and then choose 'save target as' from the pop-up menu. A window will then pop up in which you can choose a location for the file.


    © copyright 2001 - 2008