Planning a One-Player Game: AllTogether

For your first playable game, you create a field of unexploded bombs and a character whose goal is to get from one side to the other without touching one off. To make the game more challenging, you set the bombs in motion. Let’s call this game AllTogether because it incorporates everything you’ve done so far.

Before you get to the code, you need to do some planning. For example, here are some common elements found in most playable games. Not every game has all of these, but for the most part, you can expect them in a typical game:

  • A user-controlled character (the protagonist) who faces the game’s obstacles and challenges and must overcome them
  • Dire consequences, which are the repercussions the protagonist faces as a result of failing to overcome the game’s obstacles
  • Rewards for success

These elements may look too obvious, but they’re critical to being able to shape your game properly. Note that the first criterion isn’t relevant for strategy games where the player controls an entire world. You work with a strategy game in Chapter 9, so you can see there how that is done.

The first item on the list is where 90% of programming comes in. If you envision your favorite game, almost the entire thing consists of the journey or quest to achieve certain goals and beat certain levels. The last two items are often very quick and merely serve to give the game meaning. Failure can mean running out of air under water, in which case your character dies. Alternatively, it could be that you’re unable to complete the level quickly enough, and you must start over. Success is obvious when you reach the end of the stage or kill the final boss.

The game I created for this example has the first ttwo elements taken care of. You add the last one a little later in this chapter. To keep it simple, I wanted to create a game where the user must navigate three objects that are sliding up and down. The user must carefully time the bombs and then have the reflexes to run through quickly.

If the user hits one of the bombs, they’re sent back to the starting point and allowed to try again. The game continues until they get bored and turn off the game. After looking at the original code, you add some features like the ability to display a victory message so the user can recognize their success. Take a look at the finished product in Figure 5-1.

images

Figure 5-1. Beating the game

With this quick overview of the game, you’re ready to make it a reality.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.146.176.91