Game Development Reference
In-Depth Information
CHAPTER 8
Creating Your Actor Engine:
Design the Characters for Your
Game and Define Their Capabil-
ities
scratch coding here in
Chapter 8
, and create the
public abstract class
framework that
we can use to create the different types of
sprites
that we will be using in our InvinciBa-
gel game. This essentially equates to your “
Actor Engine
” for your game, as you'll
define and design the various types of game components that your game will include as
actors, and these two classes will be used to create all of the other classes that will be
used to create the objects (components) that are in your game. These would include
things such as the InvinciBagel himself (the Bagel class), his adversaries (the Enemy
class), all the treasure he looks for during the game (the Treasure class), things that are
shot at him (the Projectile class), things that he navigates over and around (the Prop
classes), all providing game objectives that InvinciBagel must try and achieve.
During this chapter, we will create
two
public abstract class constructs. The first, the
Actor
class, will be the superclass of the other, the
Hero
subclass. These two abstract
classes can be used during the topic to create both our
fixed sprites
, which are sprites
that do not move (obstacles and treasure), using the Actor superclass, and sprites that
move around the screen, using a
Hero
subclass of the Actor class. The Hero class will
provide additional methods and variables for motion sprites (the superhero, and his arch
enemies in the multi-player version of the game). These will track things like collision
and physics characteristics, as well as Actor animation (motion states). Having lots of