I wrote this some time ago to get familiar with Python and the PyGame library that is available for it. I wanted to make something that was inspiring and fun and so far it’s ticking both of those boxes for me. I had a bit of a hack around on it tonight at the CodeCraft Hackathon Event and thanks to Matt Cook for helping me to refactor things.

This blog post is an update with my progress.

So far:

  • No sounds
  • Player can fly around, turn and thrust forward and back
  • Asteroids randomly position and have initial rotation rate
  • Actors (player, bullet, asteroids) bounce off screen sides
  • Collision detection for bullets and asteroids, on collision asteroid splits into two smaller ones heading in opposite directions
  • Some serious performance issues due to unnecessary collision detection for all objects on screen - O(n2) I think!

Coming up next:

  • Abstraction of display coordinates so objects are positioned in (0,0) (1,1) space instead of on a (0,0) (w,h) screen
  • Ignore collision detection for distant objects
  • On screen display for score and level
  • Asteroids regenerate when all destroyed, but one or two more each level
  • Powerups
  • “Telefrag” when an asteroid spawns on top of player
  • Different scene draw methods allowing the game to switch to different rendering modes (I really want a retro pixelated mode!)