[Thread Prev] [Thread Next]
Hi!
You want t2 to run after t1 without actually reaching it?
How about asking t2 to point towards 2, and then moving towards it if
and only if the distance between the two is greater than a certain
number:
to getcloser
towards "t1
if (distance "t1) > 40 [fd 2]
end
Put that in t2's backpack (Proc tab) and put getcloser in the onclick
field, in forever mode. Click on t2. Move t1 around. You will see t2
running after t1, not touching it.
Play with parameters (40 and 2) until suitable.
This is just a suggestion. You will probably have to alter the proc
to get the desired behavior.
Good luck,
Alain Tougas
alain@xxxxxxx
B: (514) 939-8700 poste 237
Le 07-07-08 à 08:40, John Kendall a écrit :
Hi, Everyone,
I'm teaching a summer school class of 6th, 7th and 8th graders,
using MicroWorlds.
Two of my students are creating an animation with the gym
background, and two of the basketball playing shapes for two
turtles (first turtle is named "bbof" for "basketball offense" and
the second turtle is named "bbdf" for "basketball defense").
They want the offensive basketball turtle to drive towards the
basket while dribbling the ball, and attempt to make a "lay up."
They also want the defensive basketball turtle to follow the first
player, but can't "touch" it, because that would be a foul in the
actual game.
The "How do I make a turtle move to touch another turtle?" (http://
mia.openworldlearning.org/howdoi/rns.htm) in the "How Do I?"
section of the OWL / MIA web site helps explain one turtle pointing
towards another turtle, but we don't want our defensive player to
land "on" the first one. Is there a "plus" or "minus" bit of code
which would help adapt my students' animation? I'm not good with
the math part, but I keep thinking it wouldn't be hard to adjust.
John Kendall
Rutgers Preparatory School
Somerset, New Jersey
Previous by thread:
Second Turtle following First Turtle, but from a Distance
Next by thread:
Re: Second Turtle following First Turtle, but from a Distance
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.
|