Options
All
  • Public
  • Public/Protected
  • All
Menu

Class StagedGame

Base class for a game with multiple stages/screens. Use this to easily handle the transitions between various stages. It also has a concept of stage stack to temporarily move to a different stage (pushing it on the stack), keeping the state of the current stage and coming back (poping from the stack).

Hierarchy

  • StagedGame

Index

Constructors

Properties

currentStage: Stage<StagedGame>
input: InputState
stageStack: Stage<StagedGame>[]
stages: Map<string, Stage<StagedGame>>
stopLoop: (() => void)

Type declaration

    • (): void
    • Returns void

Methods

  • init(): void
  • Init the game.

    Returns void

  • Stop the current stage and go to the previous one.

    Returns StagedGame

  • Temporarily suspend the current stage and move to a new one.

    Parameters

    Returns StagedGame

  • render(): void
  • Called on each frame to render the states. Don't override this, instead use the stage update method.

    Returns void

  • run(): void
  • Run the game. Call super.run() if you override this.

    Returns void

  • Set the current stage, either by name (previously registered with addStage) or by the Stage object itself.

    Parameters

    Returns StagedGame

  • stop(): void
  • Stop the game.

    Returns void

  • update(dt: any): void
  • Called on each frame to update the states. Don't override this, instead use the stage update method.

    Parameters

    • dt: any

    Returns void

Generated using TypeDoc