Input Forge - v0.3.1
    Preparing search index...

    Class Command<T>Abstract

    Base class for all input commands. Extend this class to create custom commands that respond to input events.

    Commands have three lifecycle methods that are called based on input state:

    • trigger() - Called once when the input becomes active (key pressed, button pressed)
    • update() - Called every frame while the input remains active
    • release() - Called once when the input becomes inactive (key released, button released)
    class JumpCommand extends Command {
    constructor(private player: Player) {
    super();
    }

    trigger(): void {
    this.player.jump();
    }

    update(): void {
    // Called while jump key is held - extend jump height
    this.player.extendJump();
    }

    release(): void {
    // Called when jump key is released
    this.player.endJump();
    }
    }

    Type Parameters

    • T = void

      The type of value passed to trigger/update (default: void)

    Hierarchy (View Summary)

    Index

    Constructors

    Methods

    Constructors

    • Type Parameters

      • T = void

        The type of value passed to trigger/update (default: void)

      Returns Command<T>

    Methods

    • Called once when the input becomes inactive. Override this to handle cleanup or end states.

      Returns void

    • Called once when the input becomes active. Override this to handle the initial input event.

      Parameters

      • Optional_value: T

        Optional value associated with the input

      Returns void

    • Called every frame while the input remains active. Override this to handle continuous input.

      Parameters

      • Optional_value: T

        Optional value associated with the input

      Returns void