If you're seeing this message, it means we're having trouble loading external resources for Khan Academy.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

We're going to create a game called Hoppy Beaver. It's a lot like a game you may have heard of, Flappy Bird, but it's got a few differences too. In this game, the user can control a beaver, making it hop up, so that it can grab sticks to make its den. Here's what it looks like to play:

Let's walk through how we might make this game, step by step.

First, let's think about the different components of the game - what we might find in many games:

  • The playable character: We only have one playable character, and that's the beaver. That character has some different behaviors, like hoppong and falling, which we'll need to implement.
  • Non-playable characters: Many games have "NPCs" which are programmatically controlled, and present an obstacle to the character. The only obstacle in this game is the environment, however, there are no NPCs. That simplifies things!
  • Environment: This is a side-scroller type game, where we see a 2-d world that is scrolling by us, with a clear blue sky, ground, and grass. The sky is filled with sticks that can be collected.
  • Overall mission: The beaver must hop to grab sticks, and she can't hop too high above or below it, or she won't pick it up. The goal is to get to the end of the level with enough sticks to create a nest.

Whenever you design a game, you should think through components like that. In fact, game design documents are often many pages long - we've written a very concise version here, just as an example. Now let's implement each component of the game, in roughly that order.