[Thread Prev] [Thread Next]
> 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.
|