Namespace: game

me. game

me.game represents your current game, it contains all the objects, tilemap layers, current viewport, collision map, etc...
me.game is also responsible for updating (each frame) the object status and draw them
Source:
game.js, line 9

Members

<static> HASH :Object

Provide an object hash with all tag parameters specified in the url.
Type:
  • Object
Properties:
Name Type Argument Default Description
hitbox Boolean <optional>
false draw the hitbox in the debug panel (if enabled)
velocity Boolean <optional>
false draw the entities velocity in the debug panel (if enabled)
quadtree Boolean <optional>
false draw the quadtree in the debug panel (if enabled)
webgl Boolean <optional>
false force the renderer to WebGL
debug Boolean <optional>
false display the debug panel (if preloaded)
debugToggleKey String <optional>
"s" show/hide the debug panel (if preloaded)
Source:
game.js, line 113
Example
// http://www.example.com/index.html#debug&hitbox=true&mytag=value
console.log(me.game.HASH["mytag"]); //> "value"

<static> mergeGroup :boolean

when true, all objects will be added under the root world container.
When false, a `me.Container` object will be created for each corresponding groups
Type:
  • boolean
Default Value:
  • true
Source:
game.js, line 76

<static> sortOn :string

Specify the property to be used when sorting entities. Accepted values : "x", "y", "z"
Type:
  • string
Default Value:
  • "z"
Source:
game.js, line 87

<static> viewport :me.Camera2d

a reference to the game main viewport.
Type:
Source:
game.js, line 57

<static> world :me.Container

a reference to the game world,
a world is a virtual environment containing all the game objects
Type:
Source:
game.js, line 66

Methods

<static> getParentContainer(child) → {me.Container}

Returns the parent container of the specified Child in the game world
Parameters:
Name Type Description
child me.Renderable
Source:
game.js, line 227
Returns:
Type
me.Container

<static> onLevelLoaded()

Fired when a level is fully loaded and
and all entities instantiated.
Additionnaly the level id will also be passed to the called function.
Source:
game.js, line 98
Example
// call myFunction () everytime a level is loaded
me.game.onLevelLoaded = this.myFunction.bind(this);

<static> repaint()

force the redraw (not update) of all objects
Source:
game.js, line 239

<static> reset()

reset the game Object manager
destroy all current objects
Source:
game.js, line 178

<static> updateFrameRate()

Update the renderer framerate using the system config variables.
Source:
game.js, line 203
See: