28.04.2019 Views

[JAVA][Beginning Java 8 Games Development]

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 6 ■ The Foundation of Game Design: The <strong>Java</strong>FX Scene Graph and the InvinciBagel Game Infrastructure<br />

scoreButton.setOnAction(new EventHandler() {<br />

@Override<br />

public void handle(ActionEvent event) {<br />

splashScreenTextArea.setImage(scoresLayer);<br />

}<br />

});<br />

legalButton.setOnAction(new EventHandler() {<br />

@Override<br />

public void handle(ActionEvent event) {<br />

splashScreenTextArea.setImage(legalLayer);<br />

}<br />

});<br />

As Figure 6-11 demonstrates, your event-handling code is error free, and you are ready to run and test again!<br />

Figure 6-11. Modify the body of the .handle() method for each of four Button controls to complete the infrastructure<br />

As you can see, you are leaving the gameButton.setOnAction() event-handling structure empty for now; in the<br />

next chapter, you will create the primary game play surface and a pulse event-processing engine (structure) that will<br />

run this game by calling the various functional engines that you will be writing over the course of the book.<br />

You are leaving the bottom part of the high scores screen blank for now as well so that you can overlay the<br />

two ImageView layers with a TableView Node object in your Scene Graph root StackPane. You will complete this<br />

composite for the High Scores button UI element later on after you finish developing your <strong>Java</strong> 8 game.<br />

www.it-ebooks.info<br />

141

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!