Class GameObjectManager
Defined in: GameObjectManager.js.
Constructor Attributes | Constructor Name and Description |
---|---|
A manager for all the objects in the game
|
Field Attributes | Field Name and Description |
---|---|
A reference to the ApplicationManager instance
|
|
A reference to the in-memory canvas used as a back buffer
|
|
A reference to the backbuffer 2D context
|
|
A reference to the canvas element
|
|
A reference to the 2D context of the canvas element
|
|
An array of game objects
|
|
The time that the last frame was rendered
|
|
The global scrolling value of the x axis
|
|
The global scrolling value of the y axis
|
Method Attributes | Method Name and Description |
---|---|
addGameObject(gameObject)
Adds a new GameObject to the gameObjects collection
|
|
draw()
The render loop
|
|
removeGameObject(gameObject)
Removes a GameObject from the gameObjects collection
|
|
Initialises this object
|
Class Detail
GameObjectManager()
A manager for all the objects in the game
Author: Matthew Casperson.
Author: Matthew Casperson.
Field Detail
{ApplicationManager}
applicationManager
A reference to the ApplicationManager instance
{HTMLCanvasElement}
backBuffer
A reference to the in-memory canvas used as a back buffer
{CanvasRenderingContext2D}
backBufferContext2D
A reference to the backbuffer 2D context
{HTMLCanvasElement}
canvas
A reference to the canvas element
{CanvasRenderingContext2D}
context2D
A reference to the 2D context of the canvas element
{Arary}
gameObjects
An array of game objects
{Date}
lastFrame
The time that the last frame was rendered
{Number}
xScroll
The global scrolling value of the x axis
{Number}
yScroll
The global scrolling value of the y axis
Method Detail
addGameObject(gameObject)
Adds a new GameObject to the gameObjects collection
- Parameters:
- gameObject
- The object to add
draw()
The render loop
removeGameObject(gameObject)
Removes a GameObject from the gameObjects collection
- Parameters:
- gameObject
- The object to remove
startupGameObjectManager()
Initialises this object
- Returns:
- A reference to the initialised object