Lab 3 -- take 2, CSC 101

Lets take another pass at trying to animate our ball to bounce up and down.
Instead, we will be replacing the Falling function completely with a new conditional test.
One way to code the behavior we want is to use a flag inside the ball class that encodes which way the ball should travel (either up or down). Then we will set the value of this flag depending on the balls location and move based on its' value. We also will only change this value when the ball's height is equal to a particular location.
Start by adding a data value to the ball object called going_up which represents whether the ball should be traveling up or down. Always start this flag out as False.
Now write the function testBounce which sets the ball's flag going_up to True only if the current height is equal to the floor (560).

Now, modify the testTop to set going_up to False if the ball reaches the "top" (a y value of 100).
Now, remove the move_down and the Falling test in main and instead put code into move that moves in the "right" direction depending on the going_up flag. Now in main be sure to call testBounce and testTop before you move.

When you've completed these tasks, your ball should appear to bounce up and down infinitely.

Demonstration

Demonstrate the test cases from the first part of the lab to your instructor and your bouncing ball to have this lab recorded as completed. In addition, be prepared to show your instructor the source code.