Chapter 12. Making a single-screen platformer

 

Ms. Finebean is late for her brother’s wedding. This teacher knew it would be a tight squeeze to get from her school to the ceremony on time, so she came to school already dressed up. Now she needs to navigate her way out of the school, except there are 30 clingy kindergarteners, shown in figure 12.1, in her way.

Figure 12.1. A game of School Escape requires a single backdrop, a teacher, four variations of kindergarteners, a clock, a desk, and a door to the outside world.

School Escape is a single-screen side-scrolling platformer. Although it will look as if Ms. Finebean is racing across the screen, leaping onto her desk and over students, the main sprite will be running in place while the other sprites move toward her. This is how Nintendo’s 1985 hit Super Mario Bros operates. Mario looks as if he is running forward to jump onto the brick platforms in order to collect coins and flowers and move over the Goombas (which are, strangely enough, mushrooms with legs), but it’s really the platforms, backgrounds, and sprites coming at Mario, who can only jump up and down.

Drawing the sprites for this game means thinking about shadows and how they add realism to even cartoonish drawings. Although you’ve worked on adding shading to objects, for this game you’re going to think about the way light interacts with objects beyond the surface.

In this chapter, you will learn

Prepping the backgrounds

Prepping the main sprites

Preparing the code