Game Development Reference
In-Depth Information
Below the InvinciBagel Scene object, which is actually created inside this Invin-
ciBagel Application subclass, is the broader structural design for functional classes that
you will need to code over the course of the remainder of the topic. The engines
(classes) shown in the figure will create your game functions, such as game engine
(gameplay loop), logic engine (game play logic), sprite engine (actor management),
actor engine (actor attributes), score engine (game-scoring logic), animation engine
(animation logic), collision detection , and physics simulation . You will have to create
all these Java class functions to fully implement a comprehensive, 2D game engine for
the InvinciBagel game.
The game engine, which I call the GamePlayLoop class, is the primary class that
creates the AnimationTimer object that invoke the pulse events that continually process
the gameplay loop. This loop, as you know, will call the .handle() method, which will
in turn contain method calls, which will ultimately access the other classes that you
will be creating to manage actors (sprite engine); move them around the screen (actor
engine); detect any collisions (collision engine); apply the game logic after collisions
have been detected (logic engine); and apply the forces of physics to provide realistic
effects, such as gravity and acceleration, to the game play (physics engine).
From Chapter 7 on, you will be building up these various engines, which will be
used to create the game play experience. I will stratify chapter topics, based on each of
these engines and what they need to do, so that everything is structured logically from
a learning as well as coding perspective.
JavaFX Scene Graph Design: Minimiz-
ing UI Nodes
The trick to minimizing the Scene Graph is to use as few nodes as possible to imple-
ment a complete design, and, as you can see in Figure 6-3 , this can be accomplished
with one StackPane root node, one VBox branch (parent) node, and seven leaf (chil-
dren) nodes (one TableView , two ImageView , and four Button UI controls). When
you get into coding the Scene Graph next (finally!), you will use only 14 objects, and
import only 12 classes, to make the entire top level for your InvinciBagel game, which
you designed in the previous section, a reality. The TableView will overlay the
ImageView composite, which contains the information screen layers of the design. This
TableView object will be added in later stages of your game design. An ImageView
backplate will contain the InvinciBagel artwork; an ImageView compositing layer
will contain three different transparent images, which will seamlessly overlay the back-
 
Search WWH ::




Custom Search