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.StringJUMP_ACTIONThe identifier that is used by this controller to execute the jumpingEntityActionon 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 voidaddJumpKey(int keyCode)Adds a jump key.java.util.List<java.lang.Integer>getJumpKeys()Gets the list of jump key codes in this controller.voidhandlePressedKey(java.awt.event.KeyEvent keyCode)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
public static final java.lang.String JUMP_ACTIONThe 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.
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:
handlePressedKeyin 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
