T
- The type of the controlled entity.public class PlatformingMovementController<T extends IMobileEntity> extends KeyboardEntityController<T>
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
JUMP_ACTION
The identifier that is used by this controller to execute the jumping
EntityAction on the related entity. |
Constructor and Description |
---|
PlatformingMovementController(T entity)
Instantiates a new platforming movement controller.
|
PlatformingMovementController(T entity,
int jump)
Instantiates a new platforming movement controller.
|
Modifier and Type | Method and 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.
|
addDownKey, addLeftKey, addRightKey, addUpKey, getDownKeys, getLeftKeys, getRightKeys, getUpKeys, setDownKeys, setDownKeys, setLeftKeys, setLeftKeys, setRightKeys, setRightKeys, setUpKeys, setUpKeys
apply, attach, decelerateVelocityX, decelerateVelocityY, detach, getActiveForces, getDx, getDy, getEntity, getForce, getStopThreshold, getVelocityX, getVelocityY, handleMovement, isMovedX, isMovedY, isMovementAllowed, moveEntity, onMoved, onMovementCheck, setDx, setDy, setMovedX, setMovedY, setVelocityX, setVelocityY, update
public static final java.lang.String JUMP_ACTION
EntityAction
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 an EntityAction
.
public PlatformingMovementController(T entity)
entity
- the entitypublic PlatformingMovementController(T entity, int jump)
entity
- the entityjump
- the jumppublic void handlePressedKey(java.awt.event.KeyEvent keyCode)
handlePressedKey
in class KeyboardEntityController<T extends IMobileEntity>
public void addJumpKey(int keyCode)
keyCode
- the key code for the newly added jump keypublic java.util.List<java.lang.Integer> getJumpKeys()
public void setJumpKeys(int... jump)
jump
- the new jump keys