Build games as easily as you play them — join the Phaser Beam waitlist for Early Access.
class Example extends Phaser.Scene { create () { const button = this.add.text(400, 300, 'Play Game', { fontFamily: 'Arial', fontSize: '32px', color: '#ffffff', align: 'center', fixedWidth: 260, backgroundColor: '#2d2d2d' }).setPadding(32).setOrigin(0.5); button.setInteractive({ useHandCursor: true }); button.on('pointerover', () => { button.setBackgroundColor('#8d8d8d'); }); button.on('pointerout', () => { button.setBackgroundColor('#2d2d2d'); }); } } const config = { type: Phaser.AUTO, parent: 'phaser-example', width: 800, height: 600, scene: Example }; const game = new Phaser.Game(config);
class Example extends Phaser.Scene
{
create ()
{
const button = this.add.text(400, 300, 'Play Game', {
fontFamily: 'Arial',
fontSize: '32px',
color: '#ffffff',
align: 'center',
fixedWidth: 260,
backgroundColor: '#2d2d2d'
}).setPadding(32).setOrigin(0.5);
button.setInteractive({ useHandCursor: true });
button.on('pointerover', () => {
button.setBackgroundColor('#8d8d8d');
});
button.on('pointerout', () => {
button.setBackgroundColor('#2d2d2d');
});
}
}
const config = {
type: Phaser.AUTO,
parent: 'phaser-example',
width: 800,
height: 600,
scene: Example
};
const game = new Phaser.Game(config);