Controlling Your Action Figure: Implementing Java Event Handlers and Using Lambda Expressions
Now that we have created the public abstract Actor and Hero classes, which I call the "actor engine," in Chapter 8, let's get back into our InvinciBagel.java primary application class coding here in Chapter 9, and create the event handling framework that we can use to control the primary hero for our game, the InvinciBagel himself. The event handling that implements the interface between the player and your game programming logic could be looked at as the "interactivity engine" for your game, if we follow the engine paradigm we have been using thus far. There are many ways to interface with a game, including arrow keys (also known as a DPAD for consumer electronics devices), the keyboard, a mouse or trackball, a game controller, touchscreen, or even advanced hardware, such as gyroscopes and accelerometers. One of the choices you will make for your game development will be how a player will interface with the game, using the hardware device they are playing the game on, and the input capabilities it supports.