Class KeyboardPlayerInputComponent
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.input.InputComponent
com.csse3200.game.components.player.KeyboardPlayerInputComponent
- All Implemented Interfaces:
com.badlogic.gdx.input.GestureDetector.GestureListener
,com.badlogic.gdx.InputProcessor
Input handler for the player for keyboard and touch (mouse) input.
This input handler only uses keyboard input.
-
Field Summary
Fields inherited from class com.csse3200.game.input.InputComponent
priority
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint[]
Gets the current on ladder state of the playercom.badlogic.gdx.math.Vector2
Return current walk direction.boolean
keyDown
(int keycode) Triggers player events on specific keycodes.boolean
keyUp
(int keycode) Triggers player events on specific keycodes.void
setOnLadder
(boolean set) Sets the on ladder state of the player to the given boolean valuevoid
setWalkDirection
(com.badlogic.gdx.math.Vector2 walkDirection) Set current walk direction.Methods inherited from class com.csse3200.game.input.InputComponent
create, dispose, fling, getPriority, keyTyped, longPress, mouseMoved, pan, panStop, pinch, pinchStop, pinchStopHandled, scrolled, setPriority, tap, touchCancelled, touchDown, touchDown, touchDragged, touchUp, zoom
Methods inherited from class com.csse3200.game.components.Component
earlyUpdate, getEntity, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, update
-
Constructor Details
-
KeyboardPlayerInputComponent
public KeyboardPlayerInputComponent()
-
-
Method Details
-
keyDown
public boolean keyDown(int keycode) Triggers player events on specific keycodes.- Specified by:
keyDown
in interfacecom.badlogic.gdx.InputProcessor
- Overrides:
keyDown
in classInputComponent
- Returns:
- whether the input was processed
- See Also:
-
keyUp
public boolean keyUp(int keycode) Triggers player events on specific keycodes.- Specified by:
keyUp
in interfacecom.badlogic.gdx.InputProcessor
- Overrides:
keyUp
in classInputComponent
- Returns:
- whether the input was processed
- See Also:
-
getWalkDirection
public com.badlogic.gdx.math.Vector2 getWalkDirection()Return current walk direction. (Only current use is for transfers between resets.)- Returns:
- walkDirection
-
setWalkDirection
public void setWalkDirection(com.badlogic.gdx.math.Vector2 walkDirection) Set current walk direction. (Only current use is for transfers between resets.)- Parameters:
walkDirection
- - walkDirection to set.
-
getInputHistory
public int[] getInputHistory() -
getIsCheatsOn
-
getOnLadder
Gets the current on ladder state of the player- Returns:
- boolean value of the state.
-
setOnLadder
public void setOnLadder(boolean set) Sets the on ladder state of the player to the given boolean value- Parameters:
set
- boolean value to set the on ladder state too.
-