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


As you can see in Figure 14-22, use Run ➤ Project to confirm that the construction of the game board is
halfway done!


Add the Java statements for the final SceneGraph construction code for the gameBoard Group branch
next. Your 3D Scene hierarchy should look like the following, as shown highlighted using yellow and light
blue in Figure 14-23:


root.getChildren().addAll(gameBoard, uiLayout);
gameBoard.getChildren().addAll(Q1, Q2, Q3, Q4);
Q1.getChildren().addAll(q1, Q1S1, Q1S2, Q1S3, Q1S4, Q1S5);
Q2.getChildren().addAll(q2, Q2S1, Q2S2, Q2S3, Q2S4, Q2S5);
Q3.getChildren().addAll(q3, Q3S1, Q3S2, Q3S3, Q3S4, Q3S5);
Q4.getChildren().addAll(q4, Q4S1, Q4S2, Q4S3, Q4S4, Q4S5);


Figure 14-22. Quadrants 1 and 2 are now coded and aligning properly


Figure 14-23. Add all remaining SceneGraph Node object “wiring” code to add the rest of the squares to the
quadrants

Free download pdf