Build games as easily as you play them — join the Phaser Beam waitlist for Early Access.
class DemoA extends Phaser.Scene { constructor () { super({ key: 'demoA', active: true }); } preload () { this.load.setBaseURL('https://cdn.phaserfiles.com/v385'); this.load.image('picA', 'assets/pics/lance-overdose-loader-eye.png'); } create () { this.add.image(400, 300, 'picA'); this.input.on('pointerup', function () { this.scene.moveUp(); }, this); } } class DemoB extends Phaser.Scene { constructor () { super({ key: 'demoB', active: true }); } preload () { this.load.setBaseURL('https://cdn.phaserfiles.com/v385'); this.load.image('picB', 'assets/pics/sukasuka-chtholly.png'); } create () { this.add.image(400, 500, 'picB'); } } class DemoC extends Phaser.Scene { constructor () { super({ key: 'demoC', active: true }); } preload () { this.load.setBaseURL('https://cdn.phaserfiles.com/v385'); this.load.image('picC', 'assets/pics/titan-mech.png'); } create () { this.add.image(300, 300, 'picC'); } } const config = { type: Phaser.WEBGL, width: 800, height: 600, parent: 'phaser-example', scene: [ DemoA, DemoB, DemoC ] }; const game = new Phaser.Game(config);
class DemoA extends Phaser.Scene
{
constructor ()
{
super({ key: 'demoA', active: true });
}
preload ()
{
this.load.setBaseURL('https://cdn.phaserfiles.com/v385');
this.load.image('picA', 'assets/pics/lance-overdose-loader-eye.png');
}
create ()
{
this.add.image(400, 300, 'picA');
this.input.on('pointerup', function ()
{
this.scene.moveUp();
}, this);
}
}
class DemoB extends Phaser.Scene
{
constructor ()
{
super({ key: 'demoB', active: true });
}
preload ()
{
this.load.setBaseURL('https://cdn.phaserfiles.com/v385');
this.load.image('picB', 'assets/pics/sukasuka-chtholly.png');
}
create ()
{
this.add.image(400, 500, 'picB');
}
}
class DemoC extends Phaser.Scene
{
constructor ()
{
super({ key: 'demoC', active: true });
}
preload ()
{
this.load.setBaseURL('https://cdn.phaserfiles.com/v385');
this.load.image('picC', 'assets/pics/titan-mech.png');
}
create ()
{
this.add.image(300, 300, 'picC');
}
}
const config = {
type: Phaser.WEBGL,
width: 800,
height: 600,
parent: 'phaser-example',
scene: [ DemoA, DemoB, DemoC ]
};
const game = new Phaser.Game(config);