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

Members

static HASH :Object

Provide an object hash with all tag parameters specified in the url.

Properties:
Name Type Attributes 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)

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

Default Value:
  • true

static sortOn :string

Specify the property to be used when sorting entities. Accepted values : "x", "y", "z"

Default Value:
  • "z"

static viewport :me.Camera2d

a reference to the current active stage "default" camera

static world :me.Container

a reference to the game world,
a world is a virtual environment containing all the game objects

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
Returns:
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.

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

static reset()

reset the game Object manager
destroy all current objects

static updateFrameRate()

Update the renderer framerate using the system config variables.

See: