b. Zahara: Extended Version - an Excercise

Ok - this one is an Exercise for you. You need to extend the basic version of Zahara that you have created - by adding the following features:

• Three Wizard Hats in the Game World (instead of one)
• Three Chandrins (instead of one)
• At the end of the game, the user should get some feedback about the result: did he lose or win.

The following images show these features:

Multiple Chandrins and Hats:

The user wins:

The user loses:

For the most part, this version of the game will use concepts that you are already familiar with. But you will have to use some new ideas, too. Here are some hints on new things that might be helpful:

• You could use variables to keep track of the number of Wizard Hats in the world. If this variable goes down to zero, you know that the user has won.
• How do you deal with Casper collecting a Wizard Hat in the presence of multiple Wizard Hats in the world. The simplistic strategy that we used in the basic version of the game will no longer work. What was this strategy? Think for a moment about why it will no longer work? Here are some ideas for a new strategy:
• Casper could use different messages to tell the different hats that it wants to collect them.
• Or - Casper could use just a single message; then it's up to a Hat to determine if it has been collected based upon its current distance from Casper.

You are welcome to use these ideas as-is, refine them, or come up with your own.

Best of luck with this Exercise.

### Exercise Solution

A solution to the exercise is available here: zahara-2.sb. To take a look at the solution, do the following:

• Download and save the file (zahara-2.sb). This is a Scratch project file.
• Open this file within Scratch. Now you can:
• Look at the Scripts for all the Sprites in the game.
• Run the game and play with it.

Have fun!