Game Development Reference
In-Depth Information
We learned about import static statements, and we saw how to use them to wire our
iBagel Bagel object to the GamePlayLoop.java engine .handle() method. We also used
these import static statements to allow our Bagel.java class to process the Boolean up,
down, left, and right variables in the .update() method.
Next, we covered how to use conditional if statements to determine which key
events (held in four Boolean variables) were being used by the game player. We placed
this logic inside of the Bagel class .update() method, which as we know is being rap-
idly executed 60 times per second by the GamePlayLoop .handle() JavaFX pulse en-
gine.
Finally we tested all of the new methods and Java statements that we added during
the chapter to see if the basic game sprite movement works. We observed some of the
things that we will need to address in future chapters, and thoroughly tested the exist-
ing KeyEvent handling methods and iX, iY, vX, and vY attributes of the abstract Actor
class that we created as the foundation for all of our game actor assets.
In the next chapter, we are going to take a closer look at the JavaFX Node class and
also take a look at advanced concepts regarding moving the game sprite around your
screen, as well as how to ascertain the boundary (edges) of the screen, character direc-
tion, movement velocity, and related animation and movement considerations.
Search WWH ::




Custom Search