Game Development Reference
In-Depth Information
Let's now look at how the door is opened.
Opening the first door
If the lh]uan object touches `kknKja and doesn't have the key, its movement is blocked. If it does
have the key, `kknKja's eoKlaj setter is set to pnqa, and the key becomes invisible:
eb$lh]uan*depPaopK^fa_p$`kknKja%%
w
eb$lh]uan*d]oGau%
w
eb$`kknKja*eoKlaj%
w
`kknKja*eoKlaj9pnqa7
`kknGau*reoe^ha9b]hoa7
y
y
ahoa
w
?khheoekj*^hk_g$lh]uan(`kknKja%7
y
Figure 8-18 shows how the @qjcakjKja[I]j]can class checks the Lh]uan class's getter to find out what
the value of d]oGau is.
DungeonOne_Manager Class
Player Class
eb$lh]uan* d]oGau %
w
eb$`kknKja*eoKlaj%
w
`kknKja*eoKlaj9pnqa7
`kknGau*reoe^ha9b]hoa7
y
y
lq^he_bqj_pekjcap d]oGau $%6>kkha]j
w
napqnj[d]oGau7
y
Figure 8-18. The DungeonOne_Manager class checks the Player class's hasKey getter. The getter returns whatever
the value of the private _hasKey variable is. It's a Boolean variable, so it will be either true or false.
 
Search Nedrilad ::




Custom Search