Class R.engine.Game
The game object represents an instance of a game. It is
the controlling entity for the game constructs and is responsible
for setup and teardown of the game. All games must extend from this class
to be executed by the engine.
Defined in: game.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Method Attributes | Method Name and Description |
---|---|
<static> |
R.engine.Game.getFilePath(fileName)
Get the path of the specified file, relative to your game class.
|
<static> |
R.engine.Game.getGamePath()
Get the path where your game class exists.
|
<static> |
R.engine.Game.getName()
Get the display name of the game.
|
<static> |
R.engine.Game.getPlayers()
Get the number of players the game supports.
|
<static> |
R.engine.Game.load(scriptSource)
Load a script relative to this game.
|
<static> |
R.engine.Game.loadEngineScript(scriptPath)
Load a script, relative to the game engine.
|
<static> |
R.engine.Game.scriptLoaded(scriptPath)
[ABSTRACT] Will be called with the path of a loaded script.
|
<static> |
R.engine.Game.setQueueCallback(cb)
Allows a game to inject a function call into the scriping
queue to be processed when the queue has an available slot.
|
<static> |
R.engine.Game.setup()
[ABSTRACT] Initialize the game.
|
<static> |
R.engine.Game.tearDown()
[ABSTRACT] Shut down the game.
|
tick(time, dt)
This method is called just before the next frame is generated.
|
Method Detail
<static>
{String}
R.engine.Game.getFilePath(fileName)
Get the path of the specified file, relative to your game class.
- Parameters:
- fileName
- {String} The path to the file
- Returns:
- {String}
<static>
{String}
R.engine.Game.getGamePath()
Get the path where your game class exists.
- Returns:
- {String}
<static>
R.engine.Game.getName()
Get the display name of the game.
<static>
{Number}
R.engine.Game.getPlayers()
Get the number of players the game supports.
- Returns:
- {Number}
<static>
{String}
R.engine.Game.load(scriptSource)
Load a script relative to this game. Scripts cannot be specified
with an absolute URL.
- Parameters:
- scriptSource
- {String} The relative path to the script to load.
- Returns:
- {String} An Id for the script which is used in the call to #scriptLoaded when the script has completed loading (or errored out)
<static>
R.engine.Game.loadEngineScript(scriptPath)
Load a script, relative to the game engine. Scripts cannot be loaded
with an absolute URL.
- Parameters:
- scriptPath
- {String} The relative path of the script to load.
<static>
R.engine.Game.scriptLoaded(scriptPath)
[ABSTRACT] Will be called with the path of a loaded script. You can
be guaranteed that the script either loaded and is ready or failed to load.
- Parameters:
- scriptPath
- {String} The script path
<static>
R.engine.Game.setQueueCallback(cb)
Allows a game to inject a function call into the scriping
queue to be processed when the queue has an available slot.
- Parameters:
- cb
- {Function} The callback to execute
<static>
R.engine.Game.setup()
[ABSTRACT] Initialize the game. This method will be called automatically by the
engine when all dependencies for the game have been resolved.
<static>
R.engine.Game.tearDown()
[ABSTRACT] Shut down the game. This method will be called if the engine is shut down
giving a game time to clean up before it is destroyed.
tick(time, dt)
This method is called just before the next frame is generated.
- Parameters:
- time
- {Number} The current world time
- dt
- {Number} The delta between the last frame time and the world time