Sunday, March 29, 2009

Falling Blocks - A Tetris clone in Haskell using SDL

Falling Blocks my first Haskell game. It is a Tetris clone that uses SDL.

While asking some questions on IRC, someone asked me if I had put the project up on Hackage. It hadn't really occurred to me before - I thought of Hackage mainly for libraries. But I decided that there could be more examples of using SDL and the Haskell bindings for it.

The code can be found as a darcs repo at:
http://patch-tag.com/publicrepos/fallingblocks

And can be found on Hackage here:
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/fallingblocks

Play is simple:
  • Use the left/right arrow keys to move the block horizontally
  • Use the up arrow to rotate the block
  • Use the down arrow to move the block down more quickly
  • Press p to pause/unpause (0.1.4 +)
  • Press q to quit.
Thank you to everyone that helped me with this - especially those that helped me get the packaging working correctly.

A few screenshots:


Finally, a video Don Stewart put up on YouTube. Ignore the errors - those should be fixed now.

1 comment:

  1. Nice to see some haskell game code, i took some inspiration - hope you dont mind :)

    I'm making a tetris clone to get used to haskell a bit, your code is really nice learning material! I was stuck on handling the SDL-events and your solution was really nice.

    ReplyDelete