Game Development Reference
In-Depth Information
CHAPTER 10
Directing the Cast of Actors:
Creating a Casting Director
Engine and Creating the Bagel
Actor Class
Now that we have created the public abstract Actor and Hero classes (the Actor Engine)
in Chapter 8 , and some basic KeyEvent handling in Chapter 9 , it is time to put more of
our game infrastructure in place here in Chapter 10 . We are going to create yet another
Java class to manage our cast of actors, called CastingDirector.java (the Casting
Engine). We will do this so that we can keep track of the Actor objects on the game play
screen that have been created using our Actor and Hero abstract classes. It is important
to know what game components (actors) are currently on the screen (or stage, or set, if
you like the film production lingo that we are using) at any given time (or level) in the
game.
In this chapter, we'll also need to learn more about, and use, the List and ArrayList
classes as well as the Set and HashSet classes. These Java “collection” classes will
manage the List objects and Set object that we'll use to track the current Actor objects
that are involved in the game play on the screen. We'll cover these java.util package
classes in detail early on during this chapter, so get ready to learn about Java Array ob-
jects, and some other fairly advanced Java programming concepts that may be a chal-
lenge for the beginner. However, they will be very useful for you to use in your Java 8
game title development work process, so I have decided to include them in this topic.
We will also want to create our first actor for the game, the InvinciBagel character
actor, since I don't want to get too far removed from the code that we wrote in Chapter 8
Search WWH ::




Custom Search