Game Design Lab 6

Practice with Collisions: Pushing GravBalls

For this lab, you will get to practice with collisions and moving objects!

There is a file, lab6.cpp, along with a Makefile and required header teapot_classes.cpp. Download these three, compile, and explore the game world. There are a number of GravBalls stuck on the top platform (take the elevator up, or just keep jumping until you get there). Your task for this lab is to push them off the top platform.
Add code to the cycle() method of the GravBall class to make the gravball move away from the camera / player when the camera is within 1 OpenGL unit of the GravBall. It should move directly away. You can use the x and z offset from the player's position to calculate the correct direction. The GravBalls are already aware of gravity, and already bounce off platforms, so once you push them off the top platform, they should fall. Try pushing a ball onto the elevator.

Extra Credit: Push LoadedObjects off the platform

For 20% extra credit on this lab, use the LoadedObject class from in-class on October 2 to place some LoadedObjects onto the platform. You will have to add x, y, and z coordinate to LoadedObject for this, or you can create a derived class, or use LoadedObject in another class (such as GravBall). Regardless, add non-bouncy gravity, and drop LoadedObjects in a non-bouncy way off the top platform by pushing them, similar to the GravBalls.