Manage multi scene
- Create position and check if user is in position to switch in the next scene. - When scene is load, we load all scene in the layer of name "exit". - Layer "exit" of map.json have a parametter "exitSceneKey" to identify next scene. - Add layer "start", the player could start in the scene on the object present in the layer of name "start".
This commit is contained in:
parent
fb8d9bf9a8
commit
27c6034661
6 changed files with 162 additions and 26 deletions
|
@ -101,11 +101,9 @@ export class LogincScene extends Phaser.Scene implements GameSceneInterface {
|
|||
return;
|
||||
}
|
||||
let scene: any = data[1];
|
||||
scene.maps.forEach((map : any) => {
|
||||
let game = new GameScene(map.mapKey, `${API_URL}${map.mapUrl}`);
|
||||
this.scene.add(map.mapKey, game, false);
|
||||
});
|
||||
this.scene.start(scene.startMapKey);
|
||||
let game = new GameScene(scene.mapStart.key, `${API_URL}${scene.mapStart.url}`);
|
||||
this.scene.add(scene.mapStart.key, game, false);
|
||||
this.scene.start(scene.mapStart.key);
|
||||
}).catch((err) => {
|
||||
console.error(err);
|
||||
throw err;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue