level id
Optionaloptions: {additional optional parameters
OptionalcastGroundShadow?: boolean(glTF/GLB only) give this scene's meshes a ground shadow (Mesh#castGroundShadow). Overrides the application's castGroundShadow setting for this scene, in both directions; omit it to inherit. As a scene-wide opt-in it skips nodes with no vertical extent — a scene's ground plane is exactly that, and shadowing it with itself smears a blob across the whole floor
Optionalcontainer?: anycontainer in which to load the specified level
Optionalflatten?: boolean(TMX only) if true, flatten all objects into the given container
OptionallightIntensityScale?: number(glTF/GLB only) multiply each light's authored physical intensity (lux/candela) by this factor instead of normalizing it to 1 — see GLTFScene#addTo
Optionallights?: boolean(glTF/GLB only) add the scene's authored KHR_lights_punctual lights (plus a soft ambient fill) as Light3d world children; each carries its authored name for getChildByName lookups
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
OptionalshadowGroundY?: number(glTF/GLB only) world Y of the floor those shadows land on (Mesh#shadowGroundY); omit it and each blob sits at its own object's base at full strength, which is right for a scene whose props already rest on the ground
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 glTF/GLB scene (preloaded with type "glb") under a Camera3d:
// 50 pixels per glTF unit, authored lux/candela intensities kept at
// a 1/1000 scale instead of being normalized to 1
me.level.load("diorama", { scale: 50, lightIntensityScale: 0.001 });
// …and give every prop in it a ground shadow landing on the floor at y = 0
// (the scene's own ground plane is skipped — it has no height to cast)
me.level.load("diorama", { scale: 50, castGroundShadow: true, shadowGroundY: 0 });
// the authored lights are world children — grab the sun for a day/night cycle
const sun = app.world.getChildByName("Sun")[0];
load a level into the game manager
(will also create all level defined entities, etc..)