Package de.gurkenlabs.litiengine.input
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
Fields Modifier and Type Field Description static java.lang.String
JUMP_ACTION
The identifier that is used by this controller to execute the jumpingEntityAction
on the related entity.Constructor Summary
Constructors Constructor Description PlatformingMovementController(T entity)
Instantiates a new platforming movement controller.PlatformingMovementController(T entity, int jump)
Instantiates a new platforming movement controller.Method Summary
Modifier and Type Method Description void
addJumpKey(int keyCode)
Adds a jump key.java.util.List<java.lang.Integer>
getJumpKeys()
Gets the list of jump key codes in this controller.void
handlePressedKey(java.awt.event.KeyEvent keyCode)
void
setJumpKeys(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, setUpKeys
Methods 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
public static final java.lang.String JUMP_ACTIONThe identifier that is used by this controller to execute the jumpingEntityAction
on the related entity.Note that the entity needs to either specify a method with an
Action
annotation that corresponds to this identifier or it needs to explicitly register anEntityAction
.
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
public void handlePressedKey(java.awt.event.KeyEvent keyCode)- Overrides:
handlePressedKey
in classKeyboardEntityController<T extends IMobileEntity>
addJumpKey
public void addJumpKey(int keyCode)Adds a jump key.- Parameters:
keyCode
- the key code for the newly added jump key
getJumpKeys
public java.util.List<java.lang.Integer> getJumpKeys()Gets the list of jump key codes in this controller.- Returns:
- the jump keys
setJumpKeys
public void setJumpKeys(int... jump)Initializes the jump keys with a given array of key codes.- Parameters:
jump
- the new jump keys