Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var Scene = {};
- var OverWorld = {},
- Battle = {};
- OverWorld.Extends = Phaser.Scene;
- OverWorld.initialize = function () {
- Phaser.Scene.call(this, {key: "overworld"});
- };
- OverWorld.init = function (data) {
- console.log("OverWorld Scene init", data);
- this.data = data;
- };
- OverWorld.preload = function () {
- console.log("OverWorld Scene preload");
- this.load.image("bunny", "bunny.png");
- };
- OverWorld.create = function () {
- console.log("OverWorld Scene create");
- console.log("this.data", this.data);
- this.bunny = this.add.sprite(200, 200, "bunny");
- console.log(this.game);
- };
- OverWorld.update = function (time, delta) {
- //console.log(a, b);
- this.bunny.x += 10;
- if (this.bunny.x >= 800)
- this.bunny.x = 200;
- };
- Scene.OverWorld = new Phaser.Class(OverWorld);
- Battle.Extends = Phaser.Scene;
- Battle.initialize = function () {
- Phaser.Scene.call(this, {key: "battle"});
- };
- Battle.init = function (data) {
- console.log("Battle Scene init", data);
- this.data = data;
- };
- Battle.create = function (data) {
- console.log("Battle Scene create");
- this.scene.start("overworld", {xsd:123, abc:321});
- };
- Scene.Battle = new Phaser.Class(Battle);
- var config = {
- type: Phaser.AUTO,
- width: 800,
- height: 600,
- parent: "game",
- autoStart: false
- //scene: [ Scene.Battle, Scene.OverWorld ]
- };
- var game = new Phaser.Game(config);
- game.scene.add("battle", Scene.Battle);
- game.scene.add("overworld", Scene.OverWorld);
- game.scene.start("battle", {abc: 123});
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement