March Madness/Day 1

Revision as of 22:51, 1 March 2010 by imported>Jmac

My first program for this challenge is a clone of the game 'Asteroids'. It's written in Python and uses the PyGame library.


You can get PyGame from and there are versions for Windows, Unix/Linux and MacOS amongst others. If you use a common Linux distribution, it's better to get 'pygame' from your package manager.

Once you've got python and PyGame, you should be able to start it with just python Use the left and right arrow keys to rotate the ship and the up arrow to thrust forwards. Press space to shoot a missile. You can quit by pressing 'q' or escape. There's also 'p' to pause and 'o' to unpause - I added these at the last minute just so I could get a screenshot.

At the moment, there's no score, and the game continues until you run out of lives or destroy all the asteroids, at which point you'll just be left with an empty field. This was written in a couple of hours, so there lots of features left to implement. It's also done all with arrays instead of using any proper object structure, so may be a little difficult to follow.

Some ideas for future improvement:

  • Sound
  • Better collision detection (full polygon testing)
  • Score keeping and multiple levels
  • An animation when asteroids or the ship gets destroyed