Game Development Reference
In-Depth Information
Select the “I accept the terms in all of the license agreements” checkbox, and click
on the Update button, to start the downloading and installation process. As you can see
on the bottom-right of Figure 9-8 , a progress bar will tell you exactly how much has
been downloaded, as well as what is being downloaded and installed onto the system.
Let's spend the remainder of this chapter taking a look at event handling, and the
event-related classes in Java and JavaFX that we can use to provide different types of
event handling to our Java 8 game development efforts.
Event Handling: Adding Interactivity to
Your Games
One could argue that event handing is at the very foundation and core of game devel-
opment, as without a way to interface with the game play logic and actors, you really
don't have much of a game at all. I am going to cover the Java and JavaFX event hand-
ling related classes during this section of the chapter, and then we'll implement keypad
event handing, so that we can support using the arrow keys to navigate our InvinciBa-
gel character around the screen. After that, we'll turn that Java 7 compatible code into
Java 8 compatible lambda expressions, and then we will be ready to cover sprite move-
ment around the screen during the next chapter of the topic. The first thing I want to
talk about before we start dissecting Java and JavaFX classes is the different types of
events that are handled for games, from the arrow keys (DPAD on Smartphones) to
keyboard (or remotes for iTV) to mouse (or trackball on Smartphones) to touchscreen
(Smartphones and Tablets) to game controllers (Game Consoles and iTV Sets) to gyro-
scopes and accelerometers (Smartphones and Tablets) to motion controllers such as the
Leap Motion and Razer Hydra Portal.
TypesofControllers:WhatTypesofEventsShouldWe
Handle?
One of the key things to look at is what is the most logical approach to supporting
game play related events, such as arrow keys; mouse clicks; touchscreen events; game
controller buttons (A, B, C and D); and more advanced controllers, such as gyroscopes
and accelerometers that are available on Android, Kindle, Tizen, and iOS consumer
electronics devices. This decision will be driven by the hardware devices that a game is
targeted to run on; if a game needs to run everywhere, then code for handling different
Search WWH ::




Custom Search