Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

phaser 3 add button

// works with either text or an image/sprite
// const button = this.add.text( 100, 100, 'Click me!', { fill: '0f0' })
const button = this.add.sprite( 100, 100, 'button')
	.setInteractive()
	.on('pointerdown', () => button.setScale( 1.1 ))
	.on('pointerup', () => button.setScale( 1 ));
 
PREVIOUS NEXT
Tagged: #phaser #add #button
ADD COMMENT
Topic
Name
1+9 =