Build games as easily as you play them — join the Phaser Beam waitlist for Early Access.
class Example extends Phaser.Scene { preload () { this.load.setBaseURL('https://cdn.phaserfiles.com/v385'); this.load.atlas('atlas', 'assets/atlas/megaset-1.png', 'assets/atlas/megaset-1.json'); } create () { this.add.image(400, 200, 'atlas', 'titan-mech'); this.add.image(400, 400, 'atlas', 'ship'); this.add.image(400, 600, 'atlas', 'supercars-parsec'); } } const config = { type: Phaser.AUTO, parent: 'phaser-example', scene: Example }; const game = new Phaser.Game(config);
class Example extends Phaser.Scene
{
preload ()
{
this.load.setBaseURL('https://cdn.phaserfiles.com/v385');
this.load.atlas('atlas', 'assets/atlas/megaset-1.png', 'assets/atlas/megaset-1.json');
}
create ()
{
this.add.image(400, 200, 'atlas', 'titan-mech');
this.add.image(400, 400, 'atlas', 'ship');
this.add.image(400, 600, 'atlas', 'supercars-parsec');
}
}
const config = {
type: Phaser.AUTO,
parent: 'phaser-example',
scene: Example
};
const game = new Phaser.Game(config);