3. Writing your own game: Escape from Zahara

The next step on our learning to program excursion is to write a little game. Here's the storyline for our game:

A friendly ghost called Casper is trapped in a world called Zahara. Zahara is populated by demons called Chandrins that are always on the prowl in the world. If Casper runs into a Chandrin, he's going to be destroyed.
The only way for Casper to escape from Zahara is to collect all the Wizard Hats that are strewn around in the world. If he can collect the Hats before the Chandrins get him, he will be able to harness enough energy to escape from Zahara…

The game world consists of:

  • Wizard Hats lying around in the world.
  • Randomly moving Chandrins.
  • Casper the ghost, who wants to collect all the hats in the world without getting hit by the Chandrins.

Here's the plan of action. We will tackle this in two steps. First, we will build a simple version of the game with only one Wizard Hat and one Chandrin:


Then, we'll make the game a little more difficult (and fun!) for the user by having multiple Wizard Hats and Chandrins in the game world. And you'll get to do this step all by yourself as an Exercise ;) (with help from us, of course):


Let's start working on the game:

left.gif top.gif right.gif

Local Navigation Map:

Current Page: 3. Writing your own game: Escape from Zahara

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License