28.04.2019 Views

[JAVA][Beginning Java 8 Games Development]

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 7 ■ The Foundation of Game Play Loop: The <strong>Java</strong>FX Pulse System and the Game Processing Architecture<br />

The .stop() method structure will be overridden, and the method functionality, passed up to the superclass,<br />

in exactly the same fashion, using the following <strong>Java</strong> method programming structure:<br />

@Override<br />

public void stop() {<br />

super.stop();<br />

}<br />

As Figure 7-13 reveals, the GamePlayLoop class code is error free, and you can now write the code in the<br />

InvinciBagel class that starts the GamePlayLoop AnimationTimer object so that you can see pulse objects when you<br />

profile the application.<br />

Figure 7-13. Adding .start() and .stop() methods to the GamePlayLoop class and using the <strong>Java</strong> super keyword properly<br />

You will need to call this .start() method off the GamePlayLoop object named gamePlayLoop, using the new<br />

.start() method that you just created. Click the InvinciBagel.java tab, shown in Figure 7-14, and add a line of code<br />

below the GamePlayLoop object instantiation, calling the .start() method off the GamePlayLoop object named<br />

gamePlayLoop, as follows:<br />

gamePlayLoop.start();<br />

www.it-ebooks.info<br />

155

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

Saved successfully!

Ooh no, something went wrong!