Game Development Reference
In-Depth Information
kqplqp*patp9Ukqckpep7
c]iaSkj9pnqa7
aj`C]ia$%7
y
y
bqj_pekj_da_gC]iaKran$%6rke`
w
eb$cqaooaoNai]ejejc8-%
w
aj`C]ia$%7
y
y
bqj_pekjaj`C]ia$%6rke`
w
eb$c]iaSkj%
w
kqplqp*patp9Uao(ep#o'iuopanuJqi^an''Xj' ±
Epkjhupkkgukq'cqaooaoI]`a'cqaooao*7
y
ahoa
w
kqplqp*patp9E#ioknnu(ukq#ranqjkqpkbcqaooao*'Xj' ±
Pda_knna_pjqi^ans]o'iuopanuJqi^an'*7
y
y
y
y
2. Delete the following directive from the eb statement in the kjCqaoo>qppkj?he_g event han-
dler. This text will be replaced by the new text from the aj`C]ia method. There's actually no
harm in leaving it in, but it's redundant.
kqplqp*patp9Ukqckpep7
3. Save the I]ej*]o file and test the program. The game prevents you from guessing more than
ten times and tells you whether you've won or lost. Figure 5-18 shows what your game might
now look like if you guess correctly.
Figure 5-18. The game can now be
won or lost.
The game needed to figure out whether the player used up all the guesses. Before you added the new
code, you could count the guesses, but the program didn't know what to do with that information.
The new code solves that.
 
Search Nedrilad ::




Custom Search