Pro Java 9 Games Development Leveraging the JavaFX APIs

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

Make sure to open your populateQuadrantThree() method and check the image assets used to
ensure that they use the same image names. The exception is that your game square image assets are 256
pixels square, whereas the game quadrant image assets are the 512-pixel square versions and start with
“gamequad” instead of “gamesquare.”
Between these two methods, all of your gamesquare and gamequad images get loaded into the two
dozen game board texture maps used for the game board shaders that will decorate the surfaces of your
game board at any given time during the gameplay. These two dozen methods (four for the quadrants and
twenty for the squares) make sure that your game board will look visually correct for any given round of
gameplay, making sure that the game board squares have the randomly selected topic content and that the
game quadrant displays a large version of the content.
All of these two dozen methods are set up in a way that content can be added as time goes on, changing
the random.nextInt() method call to the next largest upper boundary to add a level of content. You can do
this once the game design, including other new media assets such as more animation, digital audio, 3D,
and the game questions (all of which we still have to create and code), have been completed during the next
couple chapters. You will be modifying and adding content and levels to your game long past the completion
of the initial code. You can redesign your game structure, as we have during this book, adding more classes
or methods as they become needed to expand the game.
The populateQuadrantThree() method, shown in Figure 20-13, adds in a third round of image content,
which is denoted by a 2 on the end of the file name. These assets were created on another machine (in your
case, possibly by your graphics design employee) by myself while I continued work on the Java 9 code on a
quad-core Windows 7 machine.


Figure 20-13. Confirm the populateQuadrantThree() method image assets cross-reference to the
createQSgameplay() methods

Free download pdf