Game Development Reference
In-Depth Information
The .handle() method in a GamePlayLoop object will call these .update() meth-
ods, so there is a connection there as well. There are connections between the Actor
and Hero classes with the InvinciBagel class, as all your game sprite objects created us-
ing these abstract classes will be declared and instantiated from within a method in this
class.
We are making great progress on developing our game engine framework, while at
the same time, seeing how some of the core features of the Java 8 programming lan-
guage can be implemented to our advantage. We will be looking at the powerful new
Java 8 lambda expressions feature in the next chapter on event handling as well, so
more knowledge regarding leading-edge Java 8 features is right around the (game)
bend. I hope you are as excited as I am!
Summary
In this eighth chapter, we wrote the second round of the several game engines that we
will be designing and coding during this topic, the Actor (fixed sprites) superclass, and
its Hero (motion sprites) subclass. Once we start creating our game sprites in Chapter
10 and subsequent chapters, the Hero class will also become a superclass. Essentially,
during this chapter you learned how to create public abstract classes , which will be
used to define our sprite objects from here on out during the topic. What this amounts
to is doing all the heavy lifting (sprite design and coding work) up front for all of the
actors (sprites) in our game, making the creation of powerful fixed and motion sprites
for our game much easier for us to do from here on out. We are building both our
knowledge base and our game engine framework first!
We first took a look at how these Actor and Hero classes would be designed, as
well as what types of actual sprite classes we would be creating with them. We looked
at nine sprite Image assets, and how these covered a wide range of motions by using
only nine assets, and looked at how to “register” the sprite “states” relative to each oth-
er.
Next, we designed and created our Actor superclass, to handle fixed sprites such as
props and treasure, creating the basic List<Image>, ImageView, SVGPath, iX and iY
variables and a constructor method that used these to define the fixed sprite appear-
ance, position, and collision boundaries. Then we added some additional variables that
we will be needing for future game design aspects, and learned how to have NetBeans
write .get() and .set() methods.
Next, we designed and created our Hero subclass, which extends Actor to handle
motion sprites such as the InvinciBagel himself and his enemies, as well as projectiles
Search WWH ::




Custom Search