Closed pawap90 closed 2 years ago
To run the UI Scene within the main scene:
// on create
this.scene.run('game-ui')
To send information from one scene to another scene using events:
const sceneEvents = new Phaser.Events.EventEmitter()
// Emit from the main scene
sceneEvents.emit('points-changed', this.points)
// Listen in the UI scene
sceneEvents.on('points-changed', (points: number) => {
pointsLabel.text = points.toLocaleString()
})
Show player points on the top right corner of the scene Use a UI scene