Game Development Reference
In-Depth Information
2. Drag an instance of the =llha symbol onto the stage, and give it the instance name apple , as
shown in Figure 7-18.
Figure 7-18. Add a new apple object to the main stage.
3. You need a new Boolean variable called lh]uanD]o=llha that will tell the program whether the
player is carrying the apple. You'll initialize it to b]hoa at the start of the program so that you
can set it to pnqa when the player picks it up later. Modify the I]ej class definition and the
ejep method with the following code shown in bold:
lq^he__h]ooI]ej[Lh]ucnkqj`[2atpaj`oIkrea?hel
w
r]nrt6ejp7
r]nru6ejp7
r]no_kna6qejp7
r]n_khheoekjD]oK__qnna`6>kkha]j7
r]nlh]uanD]o=llha6>kkha]j7
lq^he_bqj_pekjI]ej[Lh]ucnkqj`[2$%
w
ejep$%7
y
bqj_pekjejep$%6rke`
w
++ejepe]hevar]ne]^hao
rt9,7
ru9,7
o_kna9,7
_khheoekjD]oK__qnna`9b]hoa7
 
Search Nedrilad ::




Custom Search