Class KeyHandler
java.lang.Object
net.vincent.parkourwarrior.KeyHandler
- All Implemented Interfaces:
KeyListener,EventListener
Keyboard input handler for the game.
This class is for handling the keyboard input for the game,
the Keyhandler class is universal for all modes, as
it would determine the current state and send signals to
the target method.
- Since:
- 1.0
-
Constructor Summary
ConstructorsConstructorDescriptionKeyHandler(ParkourMain parkourMain) Constructs a newKeyHandlerwith a reference to the main game panel. -
Method Summary
Modifier and TypeMethodDescriptionvoidInvoked when a key has been pressed.voidInvoked when a key has been released.voidInvoked when a key has been typed.
-
Constructor Details
-
KeyHandler
Constructs a newKeyHandlerwith a reference to the main game panel.- Parameters:
parkourMain- the main game panel instance- Since:
- 1.0
-
-
Method Details
-
keyTyped
Invoked when a key has been typed.- Specified by:
keyTypedin interfaceKeyListener- Parameters:
e- theKeyEventto process- Since:
- 1.0
-
keyPressed
Invoked when a key has been pressed.This method handles the key press events for the game, dispatching input to the appropriate game state handler (e.g. playing, title screen, finish screen).
- Specified by:
keyPressedin interfaceKeyListener- Parameters:
e- theKeyEventto process- Since:
- 1.0
-
keyReleased
Invoked when a key has been released.This method handles key release events, stopping player movement and triggering momentum effects.
- Specified by:
keyReleasedin interfaceKeyListener- Parameters:
e- theKeyEventto process- Since:
- 1.0
-