Game Development Reference
In-Depth Information
Now let's go back into the InvinciBagel.java NetBeans editing tab, and finish wir-
ing the two classes together.
Modifying the iBagel Instantiation: Adding a Java this
Keyword to the Method Call
Open up your .createGameActors() method structure using the + expand icon on the
left side of NetBeans. Add a this keyword at the “head” or front of the list of paramet-
ers that you are passing into the Bagel() constructor method call. Your newly revised
Java statement should look like the following code, which is also shown highlighted in
Figure 12-5 :
iBagel = new Bagel( this , "M150 0 L75 200 L225 200 Z",
0,0, iB0,iB1,iB2,iB3,iB4,iB5,iB6,iB7,iB8);
Figure 12-5 . Modify the iBagel instantiation to add a Java this keyword to the Bagel() constructor method paramet-
ers
As you can see in Figure 12-5 , your Java code is error-free, which means that you
have now passed a copy of your InvinciBagel.java class's (or the object created by it,
however you prefer to look at it) context into the Bagel class (or more precisely, into
the object which is created by your use of the Bagel() constructor method). What is
contained in the digital context structure of the this object is beyond the scope of a be-
ginner book, but suffice it to say that the this keyword will pass over a complete struc-
 
 
Search WWH ::




Custom Search