Build games as easily as you play them — join the Phaser Beam waitlist for Early Access.
var config = { type: Phaser.AUTO, width: 800, height: 600, parent: 'phaser-example', scene: { preload: preload, create: create, update: update } }; var image; var game = new Phaser.Game(config); function preload () { this.load.setBaseURL('https://cdn.phaserfiles.com/v355'); this.load.image('logo', 'assets/sprites/phaser3-logo.png'); } function create () { image = this.add.image(400, 300, 'logo'); } function update () { image.rotation += 0.01; }
var config = {
type: Phaser.AUTO,
width: 800,
height: 600,
parent: 'phaser-example',
scene: {
preload: preload,
create: create,
update: update
}
};
var image;
var game = new Phaser.Game(config);
function preload ()
{
this.load.setBaseURL('https://cdn.phaserfiles.com/v355');
this.load.image('logo', 'assets/sprites/phaser3-logo.png');
}
function create ()
{
image = this.add.image(400, 300, 'logo');
}
function update ()
{
image.rotation += 0.01;
}