platformer - v1.0.0
    Preparing search index...

    Function default

    • React hook that tracks whether one or more specific keyboard keys are currently pressed.

      Parameters

      • key: string | string[]

        A single key (e.g. "Enter") or an array of keys to listen for.

      Returns boolean

      true if any of the specified keys are currently pressed, otherwise false.

      const isEnterPressed = useKeyPress("Enter");
      const isMovementKeyPressed = useKeyPress(["ArrowUp", "w"]);