Game Development Reference
In-Depth Information
Figure 6-1
.
Primary game functional screens and how they are implemented through Java and JavaFX API, using a
JVM
This will require adding three more
Button
nodes to your
StackPane
layout con-
tainer
Parent
node as well as an
ImageView
node for the splash screen background
image container. The ImageView node will have to be added to the StackPane first to
be the
first child node
in the StackPane (
z-order = 0
), as this ImageView holds what I
call the
background plate
for the splash screen UI design. Because it is in the back-
ground, the image would need to be behind the Button UI control elements, which will
have z-order values of 1 through 4.
This means that you will be using six Node objects (one parent node and five child
nodes) in your application's scene graph just to create your InvinciBagel splash screen!
The instructions and credit screens will use another ImageView node, so you are up to
six nodes already, and the high scores screen will likely use another two (ImageView
and TableView) nodes, so you likely have more than eight nodes in the Scene Graph
for creating the game support infrastructure before you have even considered adding
the nodes for the game play screen, which is, of course, where you want to get the best
performance possible for your game.
This really is not so bad if you think about it, as these screens are all
static
and do
not need to be updated, that is, the (UI) elements they contain are fixed and do not re-
quire updates using the pulse system, and so you should essentially still have
99 per-
cent
of the power of the JavaFX
pulse
engine left over to process an InvinciBagel
game
GamePlayLoop
engine. In fact, as Java 8 and JavaFX 8 continue to improve the
efficiency of their platform APIs and classes, you may actually have even more pro-
cessing power left over for game play (sprite movements, collisions, physics, anima-
tion, and so on) and thus will be in good shape.
The GamePlayLoop will process the game code for you, using the
javafx.animation
package and its
AnimationTimer
class. You will always need to be