Pro Java 9 Games Development Leveraging the JavaFX APIs

(Michael S) #1

Chapter 14 ■ 3D MoDel hierarChy Creation: Using priMitives to Create a gaMe BoarD


You will also have to open the addNodesToSceneGraph() method and change the box to Q1S1, inside
of the gameBoard node line of code, so the Q1S1 game board square will be visible in the test render we are
about to do next. Later, we’ll reference the Q1 through Q4 quadrants in this statement and then reference
the game board square objects using those branch nodes, which we’ll be doing next, to create the three-
tiered hierarchy. Your resulting Java statement should look like the following Java 9 code, which is shown
highlighted in yellow and light blue in the middle of Figure 14-4:


gameBoard.getChildren().add(Q1S1);


If you use the Run ➤ Project work process, at this point you will see in Figure 14-5 that we have reset
the 3D Scene to be just a game board square, and we can start to build other parts of your game board
relative to that square.


Figure 14-4. Add the first Q1S1 game board square to the gameBoard Group node for now so it will compile
the test render


Figure 14-5. Use the Run ➤ Project work process to test render the reconfiguration of the 3D Scene from Box to square

Free download pdf