Game Development Reference
In-Depth Information
To know whether the player has won or lost, the game first needs to know a few more things:
How many guesses the player has remaining before the game finishes.
How many guesses the player has made. This is actually optional information, but interesting to
implement so you'll give it a whirl.
When a program “needs more information” about something, it usually means that you need to cre-
ate more variables to capture and store that information. That's exactly what you'll do in this case:
create two new variables called cqaooaoNai]ejejc and cqaooaoI]`a. You'll also create a third variable
called c]iaOp]pqo that will be used to display this new information in the output text field.
1. Add the following code in bold to your program. The code that adds the new variables is pretty
straightforward, but be very careful when adding the new code to the kjCqaoo>qppkj?he_g
method because there are many new things going on there that you haven't yet seen.
l]_g]ca
w
eilknpbh]od*`eolh]u*Ikrea?hel7
eilknpbh]od*arajpo*IkqoaArajp7
lq^he__h]ooI]ejatpaj`oIkrea?hel
w
r]nop]npIaoo]ca6Opnejc7
r]niuopanuJqi^an6qejp7
r]n_qnnajpCqaoo6qejp7
r]ncqaooaoNai]ejejc6qejp7
r]ncqaooaoI]`a6qejp7
r]nc]iaOp]pqo6Opnejc7
lq^he_bqj_pekjI]ej$%
w
ejep$%7
y
bqj_pekjejep$%6rke`
w
++Ejepe]hevar]ne]^hao
op]npIaoo]ca9E]ipdejgejckb]jqi^an^apsaaj-]j`-,,7
iuopanuJqi^an91,7
cqaooaoNai]ejejc9-,7
cqaooaoI]`a9,7
c]iaOp]pqo97
++Ejepe]hevapatpbeah`o
kqplqp*patp9op]npIaoo]ca7
ejlqp*patp97
ejlqp*^]_gcnkqj`?khkn9,tBB??????7
ejlqp*naopne_p9,)57
op]ca*bk_qo9ejlqp7
 
Search Nedrilad ::




Custom Search