Game Development Reference
In-Depth Information
chapters creating our GamePlayLoop class ( Chapter 7 ) , Actor and Hero classes
( Chapter 8 ) , event handling ( Chapter 9 ) , and CastingDirector class ( Chapter 10 ) , we
need to declare some object variables at the top of the InvinciBagel.java class, before
we can instantiate and use these objects during the chapter. We will declare the Bagel
object named iBagel using the static keyword, as we will be calling the iBagel object's
.update() method from the GamePlayLoop object's .handle() method, and this will
make the iBagel “visible” across (or between) these two classes. We will also declare
the nine Image (sprite state) objects, iB0 through iB8, by using a compound declara-
tion. Finally, we will declare a CastingDirector object, which we will name castDirect-
or . The declaration statements, which we need to add at the top of our InvinciBa-
gel.java class, can be seen in Figure 11-3 . They include the following Java variable de-
claration statements, located at the top of your InvinciBagel.java class:
static Bagel iBagel;
Image iB0, iB1, iB2, iB3, iB4, iB5, iB6, iB7, iB8;
CastingDirector castDirector;
Figure 11-3 . Add static Bagel iBagel, CastingDirector castDirector and Image object declaration named iB0 through
iB8
 
 
Search WWH ::




Custom Search