var SceneA = new Phaser.Class({ Extends: Phaser.Scene, initialize: function SceneA () { Phaser.Scene.call(this, { key: 'sceneA', active: true }); 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 SceneB = new Phaser.Class({ Extends: Phaser.Scene, initialize: function SceneB () { Phaser.Scene.call(this, { key: 'sceneB', active: true }); }, preload: function () { this.load.image('face', 'assets/pics/bw-face.png'); }, create: function () { var img = this.add.image(400, 300, 'face'); this.tweens.add({ targets: img, alpha: 0, yoyo: true, repeat: -1 }); } }); var config = { type: Phaser.AUTO, width: 800, height: 600, backgroundColor: '#000000', parent: 'phaser-example', scene: [ SceneB, SceneA ] }; 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', active: true }); 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 SceneB = new Phaser.Class({ Extends: Phaser.Scene, initialize: function SceneB () { Phaser.Scene.call(this, { key: 'sceneB', active: true }); }, preload: function () { this.load.image('face', 'assets/pics/bw-face.png'); }, create: function () { var img = this.add.image(400, 300, 'face'); this.tweens.add({ targets: img, alpha: 0, yoyo: true, repeat: -1 }); } }); var config = { type: Phaser.AUTO, width: 800, height: 600, backgroundColor: '#000000', parent: 'phaser-example', scene: [ SceneB, SceneA ] }; var game = new Phaser.Game(config);