Class PlatformingMovementController<T extends IMobileEntity>

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 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:
  • 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(KeyEvent keyCode)
      Description copied from class: KeyboardEntityController
      Handles the key pressed event and updates the entity's movement direction based on the key code.
      Overrides:
      handlePressedKey in class KeyboardEntityController<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

      public List<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