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 7 ■ The Foundation of Game Play Loop: The <strong>Java</strong>FX Pulse System and the Game Processing Architecture<br />

Next, you went into the InvinciBagel.java class and declared and named a new gamePlayLoop GamePlayLoop<br />

object, using the new class you created. Then, you tested the code and profiled it to see if any new entries appeared in<br />

the Threads Live Results tabs. You also tested the .handle() method that NetBeans coded for you and changed it to an<br />

empty method to get rid of repeated errors thrown by the pulse event engine. Next, you implemented the .start() and<br />

.stop() methods, using the <strong>Java</strong> super keyword, so that you can control your use of the pulse engine if you want to add<br />

in additional <strong>Java</strong> statements, such as saving the game state, later on, when the pulse engine is started and stopped.<br />

You again tested and profiled the application to observe your progress. Finally, you placed some test code in the<br />

.handle() method so that you could again test and profile the application to make sure that the pulse event engine was<br />

quickly and consistently processing the code that you placed in the .handle() method.<br />

In the next chapter, you are going to take a look at how to create and implement abstract classes which will later<br />

be used to create your game sprites. Once we have that in place, it will allow us to display them, animate them, and<br />

process their movement on the display screen inside your new gamePlayLoop engine in real time in later chapters.<br />

164<br />

www.it-ebooks.info

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

Saved successfully!

Ooh no, something went wrong!