Class PlatformingMovementController<T extends IMobileEntity>
java.lang.Object
de.gurkenlabs.litiengine.physics.MovementController<T>
de.gurkenlabs.litiengine.input.KeyboardEntityController<T>
de.gurkenlabs.litiengine.input.PlatformingMovementController<T>
- Type Parameters:
T- The type of the controlled entity.
- All Implemented Interfaces:
IEntityController,IUpdateable,IMovementController
public class PlatformingMovementController<T extends IMobileEntity>
extends KeyboardEntityController<T>
A movement controller that supports keyboard input for horizontal entity movement.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe identifier that is used by this controller to execute the jumpingEntityActionon the related entity. -
Constructor Summary
ConstructorsConstructorDescriptionPlatformingMovementController(T entity) Instantiates a new platforming movement controller.PlatformingMovementController(T entity, int jump) Instantiates a new platforming movement controller. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddJumpKey(int keyCode) Adds a jump key.Gets the list of jump key codes in this controller.voidhandlePressedKey(KeyEvent keyCode) Handles the key pressed event and updates the entity's movement direction based on the key code.voidsetJumpKeys(int... jump) Initializes the jump keys with a given array of key codes.Methods inherited from class de.gurkenlabs.litiengine.input.KeyboardEntityController
addDownKey, addLeftKey, addRightKey, addUpKey, getDownKeys, getLeftKeys, getRightKeys, getUpKeys, setDownKeys, setDownKeys, setLeftKeys, setLeftKeys, setRightKeys, setRightKeys, setUpKeys, setUpKeysMethods inherited from class de.gurkenlabs.litiengine.physics.MovementController
apply, attach, detach, getActiveForces, getDx, getDy, getEntity, getForce, getMoveAngle, getVelocity, handleMovement, isMovementAllowed, moveEntity, onMovementCheck, setDx, setDy, setVelocity, update
-
Field Details
-
JUMP_ACTION
The identifier that is used by this controller to execute the jumpingEntityActionon the related entity.Note that the entity needs to either specify a method with an
Actionannotation that corresponds to this identifier or it needs to explicitly register anEntityAction.- See Also:
-
-
Constructor Details
-
PlatformingMovementController
Instantiates a new platforming movement controller.- Parameters:
entity- the entity
-
PlatformingMovementController
Instantiates a new platforming movement controller.- Parameters:
entity- the entityjump- the jump
-
-
Method Details
-
handlePressedKey
Description copied from class:KeyboardEntityControllerHandles the key pressed event and updates the entity's movement direction based on the key code.- Overrides:
handlePressedKeyin classKeyboardEntityController<T extends IMobileEntity>- Parameters:
keyCode- the key event containing the key code that was pressed
-
addJumpKey
public void addJumpKey(int keyCode) Adds a jump key.- Parameters:
keyCode- the key code for the newly added jump key
-
getJumpKeys
-
setJumpKeys
public void setJumpKeys(int... jump) Initializes the jump keys with a given array of key codes.- Parameters:
jump- the new jump keys
-