Game Development Reference
In-Depth Information
ject (which we will soon be creating in Chapter 10 ) , this keyword is referring to this
(iBagel) Bagel object instance. So if we wanted to set a 50% bounce factor, we would
make the following method call using our new .setBounce() setter method:
iBagel. setBounce ( 0.50 );
Next let's take a look at how these sprite Actor classes fit in with the other classes
we have coded during the topic so far. After that, we will summarize what we have
learned so far during this chapter, and we can move on into the future chapters in this
book, and use these classes to create sprites for our game, as we learn how to use
sprites for game play.
Updating the Game Design: How Actor
or Hero Fit In
Let's update the diagram that I introduced in Chapter 7 ( Figure 7-19 ) to include the
Actor.java and Hero.java classes. As you can see in Figure 8-16 , I had to switch the
.update() physics and .collide() collision parts of the diagram, as the Actor class only
includes the .update() method, and the Hero class includes both of these methods.
Since the .collide() method will be called in the .update() method, I connected these
two parts of the diagram with a chrome sphere as well.
Figure 8-16 . The current invincibagel package class (object) hierarchy, now that we have added Actor and Hero
classes
 
 
Search WWH ::




Custom Search