Create 3 new Turtles - right click on [Turtle] and choose [New
subclass]. In each actor, type the code shown above. Since the 3 are
fairly similar, you probably want to type one of them, then copy and paste
into the others.
Type the correct addObject commands into the TurtleWorld
class. Use the same coordinates as shown above.
Run the simulation and check that it performs as shown in the video
above. Make sure this works correctly before continuing.
Questions
Be prepared to answer and discuss the following questions next class. You
may need to do some work at home. If so, you'll want to
download Greenfoot from www.greenfoot.org . Also, take a
copy of your TurtleGraphics home with you.
Which command causes the acceleration due to gravity?
Which commands cause the 3 actors to bounce differently from one
another?
The baby is bouncing at 70% elasticity. Does it bounce to 70% of
it's original height? Why not?
Why are there 2 "turn" commands in the Baby's act method?
Why do the Ball and Apple contain a "turn" command in the
constructor, but the Baby does NOT have a "turn" command in the
constructor?
Change the Baby to bounce at 440 instead of bouncing at 500. Does this
work correctly?
Change the Baby to bounce at 420. This has a strange
result. Describe the strange result. Then use a pencil and paper to
calculate the values of the Baby's position and EXPLAIN why the strange
result occurs.
Change the apple so that, instead of changing to a frog, it changes to
a rocket ship which shoot back up and off the top of the screen, and it
never returns.