Class KeyboardCompanionInputComponent
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.input.InputComponent
com.csse3200.game.components.Companion.KeyboardCompanionInputComponent
- All Implemented Interfaces:
com.badlogic.gdx.input.GestureDetector.GestureListener,com.badlogic.gdx.InputProcessor
public class KeyboardCompanionInputComponent
extends InputComponent
implements com.badlogic.gdx.InputProcessor
The KeyboardCompanionInputComponent class handles keyboard input for controlling a companion character.
-
Field Summary
Fields inherited from class com.csse3200.game.input.InputComponent
priority -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new KeyboardCompanionInputComponent with a priority of 5. -
Method Summary
Modifier and TypeMethodDescriptioncom.badlogic.gdx.math.Vector2Gets the current walking direction.intReturns the value for testing.booleankeyDown(int keycode) booleankeyUp(int keycode) Handles key up events and triggers companion events based on specific keycodes.voidsetTesting(int testing) Sets the testing value.Methods inherited from class com.csse3200.game.input.InputComponent
create, dispose, fling, getPriority, keyTyped, longPress, mouseMoved, pan, panStop, pinch, pinchStop, pinchStopHandled, scrolled, setPriority, tap, touchDown, touchDown, touchDragged, touchUp, zoomMethods inherited from class com.csse3200.game.components.Component
earlyUpdate, getEntity, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, updateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.badlogic.gdx.InputProcessor
keyTyped, mouseMoved, scrolled, touchDown, touchDragged, touchUp
-
Constructor Details
-
KeyboardCompanionInputComponent
public KeyboardCompanionInputComponent()Constructs a new KeyboardCompanionInputComponent with a priority of 5.
-
-
Method Details
-
getTesting
public int getTesting()Returns the value for testing.- Returns:
- The testing value.
-
setTesting
public void setTesting(int testing) Sets the testing value.- Parameters:
testing- The value to set for testing.
-
keyDown
public boolean keyDown(int keycode) - Specified by:
keyDownin interfacecom.badlogic.gdx.InputProcessor- Overrides:
keyDownin classInputComponent- See Also:
-
InputProcessor.keyDown(int)
-
keyUp
public boolean keyUp(int keycode) Handles key up events and triggers companion events based on specific keycodes.- Specified by:
keyUpin interfacecom.badlogic.gdx.InputProcessor- Overrides:
keyUpin classInputComponent- Parameters:
keycode- The keycode of the released key.- Returns:
- True if the input was processed, false otherwise.
- See Also:
-
InputProcessor.keyUp(int)
-
getDirection
public com.badlogic.gdx.math.Vector2 getDirection()Gets the current walking direction.- Returns:
- The walking direction vector.
-