Game Development Reference
In-Depth Information
Taking it farther
This is the first complete game in this topic. But is it really done?
Game design is a funny thing. Games, being as complex as they are in so many ways, are never really
finished. Designers just stop working on them when they seem to play well enough, and no one com-
plains about them. There are usually many deep layers of complexity or added functionality that could
be added to games if the designer had enough time, patience, and imagination to do so. Patience and
imagination are things game designers seem to have in endless supply. It's usually time that throws the
spanner in the works.
There's quite a bit more that you could add to this game. Here are some ideas.
Tracking guesses
You set the game up to allow ten guesses, but some players in a hurry might not have the patience to
remember what some of their previous guesses were. You can add another text field that displays all
their previous guesses for them and adds the new guess when they make it.
To do this, you'll need a new text field, perhaps called cqaooDeopknu. You can create a new string vari-
able called lnarekqoCqaooao that stores all the guesses as a string of text, with each number separated
by a blank space. Whenever the player makes a new guess, you can add it to the lnarekqoCqaoo vari-
able and then update the cqaooDeopknu text field. Here's a sample of what the core of this code will
look like:
lnarekqoCqaooao'9_qnnajpCqaoo'7
cqaooDeopknu*patp9lnarekqoCqaooao7
This line of code will work well in the kjCqaoo>qppkj?he_g event handler. Can you see how the code
in the first directive would separate each number with a blank space?
Adding a visual display
A “hangman”-style visual display of how well (or poorly!) the player is doing is an interesting enhance-
ment. (Chapter 4 discussed how to use Movie Clip frames to create object states.) For the number
guessing game, you can create a Movie Clip object with ten different states. Each state can incremen-
tally show the player how close they are to impeding peril, like the addition of limbs to the chalk
figure in game of hangman.
Once you have the hangman Movie Clip object designed, the code is very simple to implement.
You're already using a variable called cqaooaoI]`a that tracks the number of times the player
has guessed. Each guess can be equal to a new frame in the hangman object, and you can use the
cqaooaoI]`a variable to advance it to the next frame. All you need to do is drop a line of code in your
_da_gC]iaKran method that looks something like this:
d]jci]j*ckpk=j`Opkl$cqaooaoI]`a%7
Every time the number of guesses is increased by 1, the hangman Movie Clip object advances to the
frame that matches that number.
 
Search Nedrilad ::




Custom Search