phaser 3 buttons code example
Example 1: phaser 3 add button
const button = this.add.sprite( 100, 100, 'button')
.setInteractive()
.on('pointerdown', () => button.setScale( 1.1 ))
.on('pointerup', () => button.setScale( 1 ));
Example 2: phaser3 button not working
create () {
this.startBtn = this.add.sprite(100, 100, 'startBtn').setInteractive();
this.startBtn.on('pointerover', function (event) { });
this.startBtn.on('pointerout', function (event) { });
this.startBtn.on('pointerdown', startGame);
}