CS312 Lab 7: Developing a Physics Simulation
Due Monday, March 18, at 5:00 PM
Beginning with the code in lab7start.zip, add a hill which balls will bounce off of.
Add a new class called Hill, which inherits from Ball. It's like a ball, except that:
- It does not move. So it doesn't need anything at all in the update method.
- Balls can collide with it, and that's fine. But it doesn't react to collisions at all. So the collisions method doesn't need any code.
- It isn't a mover. So the mover property has to be set to false. Note that the Ball collision handling will calculate collision energy differently when this is set, because normally both colliding entities are expected to move and absorb part of the collision.
- To be a hill, it needs to be large and located right at the bottom of the window.
Once your class is defined (which will mostly be a removal of functionality from Ball), add one to the list of objects in the window.
Note: There is a bug in the collision routine which sometimes causes balls traveling at low speed to "stick" to the hill. Don't be too concerned if this happens. If I update lab7start.zip with a fix for this bug, I'll try to remember to update this note as well.