Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Game

The base class of any game.

Hierarchy

  • Game

Implements

Index

Constructors

Properties

Methods

Constructors

constructor

  • new Game(width: number, height: number, container: HTMLElement): Game
  • Create a Game.

    Parameters

    • width: number

      The width of the game.

    • height: number

      The height of the game.

    • container: HTMLElement

      The HTML parent element for the game's canvas.

    Returns Game

Properties

container

container: HTMLElement

The parent element of the game.

height

height: number

The height of the game.

scene

scene: Scene

The scene currently being rendered.

width

width: number

The width of the game.

Methods

_start

  • _start(): void
  • Used internally to start the game.

    Returns void

create

  • create(): void
  • Called when the game is ready to run, just before it starts.
    You can set a scene and access the loaded assets safely from here.

    Returns void

load

  • load(): void
  • Called when the game is launched.
    Useful for assets loading.

    Returns void

update

  • update(): void
  • Called before rendering a frame.
    You can specify things to run every frame as long as your game is running.

    Returns void

Generated using TypeDoc