Chapter 16. Developing the Mr. Stick Man Game

Now that we’ve created the images for our Mr. Stick Man Races for the Exit game, we can begin to develop the code. The description of the game in the previous chapter gives us a basic idea of what we need: a stick figure that can run and jump, and platforms that he must jump to.

We’ll need code to display the stick figure and move it across the screen, as well as to draw platforms. But before we write that code, we need to create the canvas to display our background image.

Creating the Game Class

First, we’ll create a class called Game, which will be our program’s main controller. The Game class will have an __init__ function for initializing the game and a mainloop function for doing the animation.

Get Python for Kids now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.