Game Development Reference
In-Depth Information
After that, you learned how to create a new Java class in NetBeans and then exten-
ded the AnimationTimer superclass to create the GamePlayLoop subclass, which will
process your game play logic at 60FPS. You saw how to use NetBeans to help you
write the majority of the code for this new subclass, including the package and class
statement, the import statement, and the bootstrap .handle() method.
Next, you went into the InvinciBagel.java class and declared and named a new
gamePlayLoop GamePlayLoop object, using the new class you created. Then, you
tested the code and profiled it to see if any new entries appeared in the Threads Live
Results tabs. You also tested the .handle() method that NetBeans coded for you and
changed it to an empty method to get rid of repeated errors thrown by the pulse event
engine. Next, you implemented the .start() and .stop() methods, using the Java super
keyword, so that you can control your use of the pulse engine if you want to add in ad-
ditional Java statements, such as saving the game state, later on, when the pulse engine
is started and stopped. You again tested and profiled the application to observe your
progress. Finally, you placed some test code in the .handle() method so that you could
again test and profile the application to make sure that the pulse event engine was
quickly and consistently processing the code that you placed in the .handle() method.
In the next chapter, you are going to take a look at how to create and implement ab-
stract classes which will later be used to create your game sprites . Once we have that
in place, it will allow us to display them, animate them, and process their movement on
the display screen inside your new gamePlayLoop engine in real time in later chapters.
Search WWH ::




Custom Search