Pro Java 9 Games Development Leveraging the JavaFX APIs

(Michael S) #1
Chapter 20 ■ Coding gameplay: Set Up gameplay methodS and animated Camera View

To save on several screenshots, I have not shown the addition of the five event handling if()
structures that you have also been adding as you work on populating each new quadrant and matching
setupQSgameplay() methods over the course of this chapter, which add nearly 50 lines of Java 9 code per
quadrant.
This will result in the following 20 Java programming if() structures—which we will be filling with
calls to trigger camera animation, digital audio samples (sound effects), and more—being added to your
onMouseClicked() event handler infrastructure inside your custom createSceneProcessing() method body.
These 20 conditional if() structures can be seen selected in light blue and yellow in Figure 20-18. Notice
that I have used a red square to highlight these new setupQSgameplay() methods that we’ve added in the
first section of this chapter in the Navigator pane’s game code method Members section, which is displayed
in the far-left pane of NetBeans 9.


If you want to see all of your image assets, which are all texture maps since this is an i3D game, you can
use your OS file management utility and navigate into your /MyDocuments/NetBeansProjects/JavaFXGame/
src/ folder, as shown in Figure 20-19. I could barely fit all of these game assets (approximately 34MB) into
one screenshot! I will probably have to optimize these 120 image assets into PNG8 image assets, which
would reduce this data footprint to about 10MB. They can be even further optimized using Run Length
Encoding (RLE, also known as ZIP file compression). Most of these images will convert to 256 colors (with
dithering) quite well.


Figure 20-18. You now have all the setupQSgameplay() methods and are calling them in an OnMouseClicked
event handler

Free download pdf