My First Pygame Game
By user12607856 on Jan 09, 2007
After discovering pygame back in November, I thought I'd write a small simple game to see how easy it was to use. I finished the first version of it over the Christmas break.
If you have Pygame (and its dependancies) installed on your computer, then you can downloaded a compressed tarball of all the files you need.
Once you've unpacked the gzipped tarball, change directories to the
slidepuzzle directory, and type:
Type "s" to randomly shuffle the tiles, then use the arrow keys or the mouse to try to solve the puzzle. "q" or Esc will quit the game.
If you just want to look at the Python source code, I made the slidepuzzle.py file available too.
Note that this version uses some nice sound files, shamelessly copied from the public domain Magicor game.
The pygame API is nice and clean. Admittedly I haven't explored all there is to offer yet, but it wasn't too hard to work out what I needed in order to get this simple game working, especially after reading the tutorials first.
The next changes will be to allow you to specify any image file on the command line and the size of the grid (3x3, 4x4 or 5x5). I'll also allow you to select which square is the one that is initially removed. If I get enthused, I might further adjust it so that you don't need to use any command line options, and all these things are settable via a normal Preferences type screen.