Skip to content

Class GameManager

Moderr edited this page Feb 28, 2023 · 2 revisions
class GameManager

Manages your game.

Constructor

Constructs new GameManager with given parameters. Params:
HTMLCanvasElement canvas - The renderer canvas
GridSettings gridSettings - The canvas grid resolution
number canvasSize - canvasSize floating 0-1, represents percentage of canvas to screen size.

Public Properties

gameManager.renderer - Canvas renderer
gameManager.soundManager - Sound player

Method Summary

Instance Methods

Method Description
startGameLoop() Starts the game.
stopGameLoop() CRITICAL WARNING! Stops the game!
update() Method that tells the Renderer need to redraw frame.
updateSortingLayer() Updates the GameObject sorting.
addGameObject(gameObject) Adds GameObject to game world.
destroyGameObjectByRef(gameObject) Removes GameObject from the game world.
destroyGameObjectById(id) Removes GameObject from the game world.
destroyGameObjectByIndex(index) Removes GameObject from the game world.
getGameObjectsByType(type) Returns GameObjects by the Type argument.
getGameObjectsByName(name) Returns GameObjects by the name argument.
getGameObjectsByTag(tag) Returns GameObjects by the tag in argument.
getGameObjectById(id) Returns GameObject by id.
getGameObjects() Returns all GameObjects.

Method Details

W.I.P

Clone this wiki locally