Game Development Reference
In-Depth Information
Scene (on the Stage) to create a game world and enhance the game play experience
(also known as user experience).
We'll create four fixed Prop subclasses, using the Actor superclass, which will
make it easy to construct fixed scenes (also called levels, when you have created more
than one). The Prop.java class will use your fixed sprite Image assets “as-is,” while
the PropH.java class will set the isFlipH property to true and mirror the image asset
around the Y axis, using a JavaFX spriteFrame.setScaleX(-1); Java state-
ment. The PropV.java class will set the isFlipV property to true and mirror the image
asset around the X axis, using a JavaFX spriteFrame.setScaleY(-1); Java
statement. The PropB.java class (B stands for “both”) will set both the isFlipV prop-
erty and isFlipH property to true , which would mirror an image asset around both the
X and Y axis, using two JavaFX spriteFrame.setScale(-1); Java statements.
Once we have created these four Prop-related Actor subclasses, we will use them to
place fixed objects into the Scene to create the first level of this game. That way, when
we get into the collision detection chapter, everything that would be in a real game will
be in place, and we will be able to start coding the collision detection logic; and then,
eventually, an auto-attack engine; and then game play logic, which dictates how the
scoring engine is implemented.
This chapter will be valuable in creating a more feature-filled game. A major part
of any game design, in this case, it is Ira H. Harrison Rubin's InvinciBagel character
and game, is building the environment that the characters (the hero and his or her en-
emies, whether in a single-player or a multi-player game) engage in is critical to the
success and popularity of the game, since these fixed elements are a major part of cre-
ating the game play challenge for the player.
Creating the Prop.java Class: Extending
Actor.java
Open up the InvinciBagel project in NetBeans 8, and right-click on the invincibagel
(package) folder that contains your .java files and select the New Java Class menu
sequence. In the New Java Class dialog, shown in Figure 14-1 , name the class Prop ,
and accept the other default settings, suggested by NetBeans, and then click on the Fin-
ish button.
 
Search WWH ::




Custom Search