Skip to main content

Game

The main game class that handles game initialization and startup.


Methods


start

prototype
public start(): Game

Starts the game by initializing the game loop, keyboard, mouse, and touch inputs.

Example:

const game = new Game();
game.start();

createCanvas

prototype
public createCanvas(canvasOptions?: CanvasOptions): Game

Creates the game canvas with the specified options.

  • canvasOptions (optional): The options for the canvas.

Example:

const game = new Game();
game.createCanvas({ width: 800, height: 600 });

startScene

Prototype
public startScene(scene: Scene): Game

Adds scenes to the scene manager and selects a scene.

  • scene: The scene to start.

Example:

const game = new Game();
game.startScene(new GameScene());