Class

GameManager

GameManager()

Singleton class that manages the game and handles various p5 functionalities.
Constructor

# new GameManager()

View Source lib.js, line 286

Members

# GameInstance

The instance of the game that is playing.

View Source lib.js, line 314

Methods

# static Draw()

Static function that functions as a replacement for p5.draw. This calls Update from the GameManager Instance.

View Source lib.js, line 389

# static GetInstance()

Function to retrieve the current instance of the GameManager. Always use this function instead of the constructor! When no instance is available, one is created.

View Source lib.js, line 294

The singleton instance of the GameManager.

# static KeyPressed()

Static function that functions as a replacement for p5.kyePressed. This calls KeyPressed from the current Game instance.

View Source lib.js, line 396

# static Setup()

Sets up a Game instance, defined by the type of Game in Settings/Settings.js

View Source lib.js, line 382

# AddGameObject(gameObject)

Adds a GameObject to the current game.
Parameters:
Name Type Description
gameObject GameObject The GameObject to be added to the scene.

View Source lib.js, line 349

# AddGameObjectToCollisionLayer(gameObject, collisionLayer)

Puts the given GameObject on the given Collision Layer. Collision Layers are defined in Settings/Settings.js
Parameters:
Name Type Description
gameObject GameObject The GameObject to be added to the collision layer
collisionLayer Settings.collisionLayer Collision layer defined in the Settings file

View Source lib.js, line 359

# Init()

Initializes the canvas and game values.

View Source lib.js, line 321

# RemoveGameObject(gameObject)

Removes a GameObject from the scene.
Parameters:
Name Type Description
gameObject GameObject The GameObject to be removed from the scene.

View Source lib.js, line 334

# Update()

Update draws all GameObjects in the correct order and draws debug information in case Settings/Settings.js/Debug was set to true.

View Source lib.js, line 404