O'Reilly logo

Python for Kids by Jason R. Briggs

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required