var SceneA = new Phaser.Class({ Extends: Phaser.Scene, initialize: function SceneA () { Phaser.Scene.call(this, { key: 'sceneA' }); }, preload: function () { this.load.image('face', 'assets/pics/bw-face.png'); }, create: function () { this.add.image(400, 300, 'face').setAlpha(0.2); var _this = this; this.input.once('pointerdown', function () { this.scene.launch('sceneB'); this.scene.launch('sceneC'); }, this); } }); var SceneB = new Phaser.Class({ Extends: Phaser.Scene, initialize: function SceneB () { Phaser.Scene.call(this, { key: 'sceneB' }); this.pic; }, preload: function () { this.load.image('arrow', 'assets/sprites/longarrow.png'); }, create: function () { this.pic = this.add.image(400, 300, 'arrow').setOrigin(0, 0.5); }, update: function (time, delta) { this.pic.rotation += 0.01; } }); var SceneC = new Phaser.Class({ Extends: Phaser.Scene, initialize: function SceneC () { Phaser.Scene.call(this, { key: 'sceneC' }); this.pic; }, preload: function () { this.load.image('mech', 'assets/pics/titan-mech.png'); }, create: function () { this.pic = this.add.image(Phaser.Math.Between(300, 600), 300, 'mech'); }, update: function (time, delta) { this.pic.rotation -= 0.02; } }); var config = { type: Phaser.AUTO, width: 800, height: 600, backgroundColor: '#000000', parent: 'phaser-example', scene: [ SceneA, SceneB, SceneC ] }; var game = new Phaser.Game(config);
Scan to open on your mobile device
var SceneA = new Phaser.Class({ Extends: Phaser.Scene, initialize: function SceneA () { Phaser.Scene.call(this, { key: 'sceneA' }); }, preload: function () { this.load.image('face', 'assets/pics/bw-face.png'); }, create: function () { this.add.image(400, 300, 'face').setAlpha(0.2); var _this = this; this.input.once('pointerdown', function () { this.scene.launch('sceneB'); this.scene.launch('sceneC'); }, this); } }); var SceneB = new Phaser.Class({ Extends: Phaser.Scene, initialize: function SceneB () { Phaser.Scene.call(this, { key: 'sceneB' }); this.pic; }, preload: function () { this.load.image('arrow', 'assets/sprites/longarrow.png'); }, create: function () { this.pic = this.add.image(400, 300, 'arrow').setOrigin(0, 0.5); }, update: function (time, delta) { this.pic.rotation += 0.01; } }); var SceneC = new Phaser.Class({ Extends: Phaser.Scene, initialize: function SceneC () { Phaser.Scene.call(this, { key: 'sceneC' }); this.pic; }, preload: function () { this.load.image('mech', 'assets/pics/titan-mech.png'); }, create: function () { this.pic = this.add.image(Phaser.Math.Between(300, 600), 300, 'mech'); }, update: function (time, delta) { this.pic.rotation -= 0.02; } }); var config = { type: Phaser.AUTO, width: 800, height: 600, backgroundColor: '#000000', parent: 'phaser-example', scene: [ SceneA, SceneB, SceneC ] }; var game = new Phaser.Game(config);