Here I'm collecting some notes and the code from introducing a group of children to programming by writing a simple game in Haskell. We are using gloss-game, a simple wrapper around the Gloss 2D library, to simplify the code. To draw sprites, we are using the pixel art editor BigPixel. An iPad version of BigPixel is available from the App Store. In addition, there is also a less polished, but free cross-platform version of BigPixel.
So far, we had three coding sessions:
- Step1: Draw a simple character and move it around.
- Step2: Add gravity and bound character movement by window edges.
- Step3: Add a key binding to jump and let the character bounce when it hits the ground.
- Step4: Properly define constants, such as the window size, and implement continous moving when a movement key keeps being pressed.
- Step5: Use scenes to describe levels, and add an animation to the character when it jumps.
- Step6: Add a power up coin and let it super-charge the character.
- Step7: Use record syntax throughout for the game state and add a low platform.