Bouncing World - Simulating Gravity

 

Here is the code for the 3 actors and the constructor for the Bouncing world:

img5.gif

img3.gif  img1.gif  img7.gif

Create This Simulation

  1. Open the TurtleGraphics World - or download it again here
  2. 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.
  3. Type the correct addObject commands into the TurtleWorld class.
    Use the same coordinates as shown above.
  4. 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.

  1. Which command causes the acceleration due to gravity?
  2. Which commands cause the 3 actors to bounce differently from one another?
  3. The baby is bouncing at 70% elasticity.  Does it bounce to 70% of it's original height?
    Why not?
  4. Why are there 2 "turn" commands in the Baby's act method?
  5. 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?
  6. Change the Baby to bounce at 440 instead of bouncing at 500.
    Does this work correctly?
  7. 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.
  8. 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.