Wednesday, October 18, 2006

Bouncing Balls anyone?


This is an exercise from the 2nd last chapter in my Game Institute C++ programming course. We have to do a bouncing ball simulation, basically just get the balls to bounce all over the screen.

In my implementation, I'm just using an Ellipse to represent my bouncing ball. For each ball though, I have class containing two vectors classes, the first to represent the X and Y position on screen, and the second vector a direction vector. Thus, per frame step, I look at the direction vector and add a certain amount into the position vector.

If you want to see the exe, click here. As I'm using some Game Institute code for the backbuffer and vector operations, I don't think I can post the source code up here. The next exercise before the next chapter will be a Pong implementation! Wee.... shouldn't be too difficult.

No comments: