Game Development Reference
In-Depth Information
body of this method, eventually, as the game becomes more and more complex, this
method will serve as a “roadmap” regarding what game actor assets we have installed.
This method will be declared as a private method, since the InvinciBagel class will be
controlling the creation of these game actors, and will feature a void return type, be-
cause the method doesn't return any values to the calling entity (the .start() method in
this case). Inside of the method we'll call the Bagel() constructor method, using some
“placeholder” SVG path data, as well as a 0,0 initial X,Y screen location, and finally,
the nine sprite cels using a comma-delimited list at the end of the constructor method
call. The method body and object instantiation will use the following three lines of Java
code:
private void createGameActors() {
iBagel = new Bagel("M150 0 L75 500 L225 200 Z", 0, 0,
iB0,iB1,iB2,iB3,iB4,iB5,iB6,iB7,iB8);
}
As you can see in Figure 11-6 , the code is error-free, and you now have an iBagel
Bagel object that you can now use to start to develop the InvinciBagel sprite movement
around the game play stage, which is usually the entire display screen. We'll be wiring
this Bagel Actor up to the JavaFX pulse timing engine a bit later on during this chapter.
Figure 11-6 . Add a private void createGameActors() method; add an iBagel object instantiation via Bagel() con-
structor
 
 
Search WWH ::




Custom Search