Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const A = {};
- A.Extends = Phaser.Scene;
- A.initialize = function () {
- Phaser.Scene.call(this, {key: "sceneA"});
- };
- A.init = function (data) {
- console.log("Scene A Init", data);
- this.socket = data.socket;
- };
- A.create = function () {
- console.log("Scene A");
- this.socket.emit("lol", 123);
- };
- const SceneA = new Phaser.Class(A);
- const Battle = {};
- Battle.Extends = Phaser.Scene;
- Battle.initialize = function () {
- Phaser.Scene.call(this, {key: "battle"});
- };
- Battle.create = function () {
- console.log("Battle Scene");
- //this.scene.start("sceneA", {xsd:123, abc:321});
- };
- const BattleScene = new Phaser.Class(Battle);
- const config = {
- type: Phaser.AUTO,
- autoStart: false,
- width: 800,
- height: 600,
- parent: "game",
- };
- const gameInstance = new Phaser.Game(config);
- gameInstance.scene.add("sceneA", SceneA);
- gameInstance.scene.add("battle", BattleScene);
- gameInstance.scene.start("sceneA", {
- socket: socket,
- parametros: "pra passar pra scene"
- });
Add Comment
Please, Sign In to add comment