level id
Optionaloptions: {additional optional parameters
Optionalcontainer?: anycontainer in which to load the specified level
Optionalflatten?: boolean(TMX only) if true, flatten all objects into the given container
OptionalonLoaded?: Functioncallback for when the level is fully loaded
OptionalrightHanded?: boolean(glTF/GLB only) convert the right-handed (Y-up) source to the engine's Y-down via a rotation rather than a mirror
Optionalscale?: number(glTF/GLB only) pixels per glTF unit applied to the whole scene
OptionalsetViewportBounds?: boolean(TMX only) if true, set the viewport bounds to the map size
true if the level was successfully loaded
// the game assets to be be preloaded
// TMX maps
let 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.level.load("a4_level1");
...
...
// load a level into a specific container
let levelContainer = new me.Container();
me.level.load("a4_level2", {container:levelContainer});
// add a simple transformation
levelContainer.translate(levelContainer.width / 2, levelContainer.height / 2 );
levelContainer.rotate(0.05);
levelContainer.translate(-levelContainer.width / 2, -levelContainer.height / 2 );
// add it to the game world
app.world.addChild(levelContainer);
load a level into the game manager
(will also create all level defined entities, etc..)