Namespace: levelDirector

me. levelDirector

a level manager object
once ressources loaded, the level director contains all references of defined levels
There is no constructor function for me.levelDirector, this is a static object
Source:
LevelDirector.js, line 8

Methods

<static> getCurrentLevel() → {me.TMXTileMap}

return the current level definition. for a reference to the live instantiated level, rather use the container in which it was loaded (e.g. me.game.world)
Source:
LevelDirector.js, line 252
Returns:
Type
me.TMXTileMap

<static> getCurrentLevelId() → {String}

return the current level id
Source:
LevelDirector.js, line 240
Returns:
Type
String

<static> levelCount()

return the amount of level preloaded
Source:
LevelDirector.js, line 325

<static> loadLevel(level, options)

load a level into the game manager
(will also create all level defined entities, etc..)
Parameters:
Name Type Argument Description
level String level id
options Object <optional>
additional optional parameters
Properties
Name Type Argument Default Description
container me.Container <optional>
me.game.world container in which to load the specified level
onLoaded function <optional>
me.game.onLevelLoaded callback for when the level is fully loaded
flatten boolean <optional>
me.game.mergeGroup if true, flatten all objects into the given container
setViewportBounds boolean <optional>
true if true, set the viewport bounds to the map size
Source:
LevelDirector.js, line 166
Example
// the game assets to be be preloaded
// TMX maps
var resources = [
    {name: "a4_level1",   type: "tmx",   src: "data/level/a4_level1.tmx"},
    {name: "a4_level2",   type: "tmx",   src: "data/level/a4_level2.tmx"},
    {name: "a4_level3",   type: "tmx",   src: "data/level/a4_level3.tmx"},
    // ...
];

// ...

// load a level into the game world
me.levelDirector.loadLevel("a4_level1");
...
...
// load a level into a specific container
var levelContainer = new me.Container();
me.levelDirector.loadLevel("a4_level2", {container:levelContainer});
// add a simple transformation
levelContainer.currentTransform.translate(levelContainer.width / 2, levelContainer.height / 2 );
levelContainer.currentTransform.rotate(0.05);
levelContainer.currentTransform.translate(-levelContainer.width / 2, -levelContainer.height / 2 );
// add it to the game world
me.game.world.addChild(levelContainer);

<static> nextLevel(options)

load the next level
Parameters:
Name Type Argument Description
options Object <optional>
additional optional parameters
Properties
Name Type Argument Default Description
container me.Container <optional>
me.game.world container in which to load the specified level
onLoaded function <optional>
me.game.onLevelLoaded callback for when the level is fully loaded
flatten boolean <optional>
me.game.mergeGroup if true, flatten all objects into the given container
Source:
LevelDirector.js, line 283

<static> previousLevel(options)

load the previous level
Parameters:
Name Type Argument Description
options Object <optional>
additional optional parameters
Properties
Name Type Argument Default Description
container me.Container <optional>
me.game.world container in which to load the specified level
onLoaded function <optional>
me.game.onLevelLoaded callback for when the level is fully loaded
flatten boolean <optional>
me.game.mergeGroup if true, flatten all objects into the given container
Source:
LevelDirector.js, line 304

<static> reloadLevel(options)

reload the current level
Parameters:
Name Type Argument Description
options Object <optional>
additional optional parameters
Properties
Name Type Argument Default Description
container me.Container <optional>
me.game.world container in which to load the specified level
onLoaded function <optional>
me.game.onLevelLoaded callback for when the level is fully loaded
flatten boolean <optional>
me.game.mergeGroup if true, flatten all objects into the given container
Source:
LevelDirector.js, line 266
Copyright © 2011 - 2017, Olivier Biot, Jason Oster, Aaron McLeod
Documentation generated by JSDoc 3.4.0 on 2017-02-28T11:37:40+08:00 using the DocStrap template modified by codename-.