Build games as easily as you play them — join the Phaser Beam waitlist for Early Access.
const demo = new Phaser.Scene('Demo'); demo.preload = function () { this.load.image('face', 'assets/pics/bw-face.png'); }; demo.create = function () { console.log(this.sys.settings.key, 'is alive'); this.add.image(400, 300, 'face'); this.scene.launch('Test'); }; const test = new Phaser.Scene('Test'); test.preload = function () { this.load.image('barbarian', 'assets/pics/barbarian-loading.png'); }; test.create = function () { console.log(this.sys.settings.key, 'is alive'); this.add.image(400, 300, 'barbarian').setScale(0.5); } const config = { type: Phaser.CANVAS, parent: 'phaser-example', width: 800, height: 600, scene: [ demo, test ] }; const game = new Phaser.Game(config);
const demo = new Phaser.Scene('Demo');
demo.preload = function () {
this.load.image('face', 'assets/pics/bw-face.png');
};
demo.create = function () {
console.log(this.sys.settings.key, 'is alive');
this.add.image(400, 300, 'face');
this.scene.launch('Test');
};
const test = new Phaser.Scene('Test');
test.preload = function () {
this.load.image('barbarian', 'assets/pics/barbarian-loading.png');
};
test.create = function () {
console.log(this.sys.settings.key, 'is alive');
this.add.image(400, 300, 'barbarian').setScale(0.5);
}
const config = {
type: Phaser.CANVAS,
parent: 'phaser-example',
width: 800,
height: 600,
scene: [ demo, test ]
};
const game = new Phaser.Game(config);