Game Development Reference
In-Depth Information
Figure 7-5 . Subclass an AnimationTimer superclass with an extends keyword: press Alt+Enter, and select Add import
Once NetBeans adds the import javafx.animation.AnimationTimer;
programming statement, you will be ready to start creating this class, which will har-
ness the JavaFX pulse engine for you and contain all your core game play loop pro-
cessing, or calls to classes and methods that will perform the various types of process-
ing, such as sprite movement, sprite animation, collision detection, physics simulation,
game logic, audio processing, AI, scoreboard updates, and the like.
CreatingtheGamePlayLoopClassStruc-
ture:ImplementingYour.handle()Meth-
od
Note that once the import statement has been written for you by NetBeans, yet another
wavy red error highlight appears below the GamePlayLoop class name. Mouse over
this to find out what the error message is relating to this newest error. As Figure 7-6
demonstrates, the .handle() method required for every AnimationTimer subclass has
not yet been implemented (also called overridden) in this GamePlayLoop.java class, so
you have to do this next. Maybe you can even get NetBeans to write the code for you;
let's take a look, and see!
 
 
Search WWH ::




Custom Search