The project for this chapter, the Astrocrash game, is my version of the classic arcade game Asteroids. In Astrocrash, the player controls a ship in a moving field of deadly asteroids. The ship can rotate and thrust forward—most importantly, though, it can fire missiles at the asteroids to destroy them. But the player has some work cut out for him or her as large and medium-sized asteroids break apart into two smaller asteroids when destroyed. And just when the player manages to obliterate all of the asteroids, a new, larger wave appears. The player's score increases with every asteroid he or she destroys, but once the player's ship collides with a floating space rock, the game is over. Figures 12.1 and 12.2 show the game in action.
Figure 12.1: The player controls a spaceship and blasts asteroids to increase his or her score. (Nebula image is in the public domain. Credit— NASA, The Hubble Heritage Team - AURA/STScI)
Figure 12.2: If an asteroid hits the player's ship, the game is over.