The settings
Private
_deltaPrivate
_isPrivate
_isPrivate
Readonly
_signalsPrivate
_tempPrivate
_unscaledReadonly
canvasReadonly
gameSorted game object array
Readonly
gameReadonly
gridPrivate
lastReadonly
rendererUse input.isMousePrimaryButtonDown
instead.
since version 1.0.8
Adds unique game object to game.
The added game object
game.AddGameObject(new JSGL.GameObject());
The unique game object
Destroys existed game object by reference
const gameObject = ...
game.DestroyGameObjectByRef(gameObject);
The game object reference
Gets game object by unique id.
The game object
game.GetGameObjectById('51870300-4187221613-3012590175-3461657014');
The unique id
Gets all existed game objects by given name.
Array of game objects with given name.
game.GetGameObjectsByName('exampleName');
The name.
Gets all existed game objects by given tag.
The array of game objects with given tag.
game.GetGameObjectsByTag('exampleTag');
The - tag.
Gets all existed game objects with type equal to param.
Array of selected game objects
game.GetGameObjectsByType(JSGL.Shape);
The type
Starts loading all resources which is not loaded. Emits GameEvent at loadAllResources
channel.
Starts loading game resources and returns promise.
The Promise
game.LoadGameAndStart().then((e) => {
console.log('Game sucessfully loaded!');
}).catch((error) => {
console.error('Error');
}).finally(() => {
console.log("Finally");
});
Loads resource with resource manager.
game.LoadResource('image', 'player', './resources/img/player.png');
The resource type
The resource unique key
The resource path
Plays sound at the page.
game.PlaySound('./resources/sounds/death.mp3', false, 0.8);
The path to sound file
is looped?
The volume decimal midpoint
Starts the game loop and emit start
(GameEvent) event.
Private
Readonly
_gamePrivate
_gamePrivate
_gamePrivate
_registerPrivate
constructPrivate
mousePrivate
mousePrivate
mousePrivate
mousePrivate
mouseAppends listener to event channel.
game.on('channel', () => { console.log('received!') });
Constructs new Game instance with given settings.