March Madness/Day 1

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

Rockstorm window

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

Once you've got python and PyGame, you should be able to start it with just python rockstorm.py. 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 are 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

The program is at: http://svn.hacman.org.uk/2010_March_Madness/Day_1