-
Notifications
You must be signed in to change notification settings - Fork 0
Class GameManager
Moderr edited this page Feb 28, 2023
·
2 revisions
class GameManager
Manages your game.
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.
gameManager.renderer
- Canvas renderer
gameManager.soundManager
- Sound player
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. |
W.I.P