Chapter 10 of Beginning Game Programming builds on Chapter 9 by adding more behaviors to the sprites.

This example creates 4 different planet sprites, each with their own movement behavior. Mars stops when it hits the edge of the screen. Neptune ricochets off the edges. Jupiter wraps around the screen.  Earth revolves around the center of the screen. Additionally, when planets collide, they will bounce off each other.

For added fun, you can click and drag the planets around the screen and they will change their velocity and direction when you let them go.


Download NowName your own price

Click download now to get access to the following files: 10 MB 68 kB

Leave a comment

Log in with to leave a comment.