Class PlatformingMovementController<T extends IMobileEntity>

java.lang.Object
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 Details

    • JUMP_ACTION

      public static final java.lang.String JUMP_ACTION
      The identifier that is used by this controller to execute the jumping 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.

      See Also:
      IEntity.register(String, Runnable), Action, Constant Field Values
  • Constructor Details

    • PlatformingMovementController

      public PlatformingMovementController​(T entity)
      Instantiates a new platforming movement controller.
      Parameters:
      entity - the entity
    • PlatformingMovementController

      public PlatformingMovementController​(T entity, int jump)
      Instantiates a new platforming movement controller.
      Parameters:
      entity - the entity
      jump - the jump
  • Method Details

    • handlePressedKey

      public void handlePressedKey​(java.awt.event.KeyEvent keyCode)
      Overrides:
      handlePressedKey in class KeyboardEntityController<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