Options
All
  • Public
  • Public/Protected
  • All
Menu

Class State

Hierarchy

Index

Constructors

Properties

Methods

Constructors

constructor

  • A base class for game states. Basically just an interface with callbacks for updating and rendering, along with other lifecycle-ish methods.

    constructor

    Parameters

    Returns State

Properties

game

game: Game

Methods

init

  • init(): void
  • Called right before a state starts. Subclasses can do any needed initialization here.

    Returns void

leaving

  • leaving(game: any): void
  • Called when this state is being left for another one.

    Parameters

    • game: any

    Returns void

render

  • render(ctx: CanvasRenderingContext2D): void
  • Subclasses should override this method to render the screen.

    Parameters

    • ctx: CanvasRenderingContext2D

      The graphics context to render onto.

    Returns void

update

  • update(delta: number): void
  • Subclasses should override this method to do necessary update logic.

    Parameters

    • delta: number

      The amount of time that has elapsed since the last frame/call to this method.

    Returns void

Generated using TypeDoc