Game Development Reference
In-Depth Information
naikraArajpHeopajan$Arajp*NAIKRA@[BNKI[OP=CA( ±
kjNaikra`BnkiOp]ca%7
y
lner]pabqj_pekjkjAjpanBn]ia$arajp6Arajp%6rke`
w
Ikrea?hel$l]najp%*_da_g?khheoekjSepdLh]uan$pdeo%7
y
y
y
Despite all the code, the S]hh class does only one important thing: it sends a reference of itself to the
_da_g?khheoekjSepdLh]uan method of the @qjcakjKja[I]j]can:
Ikrea?hel$l]najp%*_da_g?khheoekjSepdLh]uan$pdeo%7
There are 19 wall objects in the game, and this class is attached to each of them. Every one of
those wall objects runs this directive. Because it's in an AJPAN[BN=IA event, it means that the
_da_g?khheoekjSepdLh]uan method of the @qjcakjKja[I]j]can is called 19 times each frame .
lq^he_bqj_pekj_da_g?khheoekjSepdLh]uan$s]hh6Ikrea?hel%
w
eb$lh]uan*l]najp9jqhh%
w
?khheoekj*^hk_g$lh]uan(s]hh%7
y
y
Figure 8-25 illustrates how the wall objects use this method.
Wall Class
X 19
Ikrea?hel$l]najp%*_da_g?khheoekjSepdLh]uan$pdeo%7
DungeonOne_Manager Class
lq^he_bqj_pekj_da_g?khheoekjSepdLh]uan$s]hh6Ikrea?hel%
w
eb$lh]uan*l]najp9jqhh%
w
?khheoekj*^hk_g$lh]uan(s]hh%7
y
y
Figure 8-25. Each of the game's 19 wall instances checks for
a collision with the player on every frame (30 times per second).
Search Nedrilad ::




Custom Search