Use events to pass data between Scenes for decoupled code.
One common best practice is to put the UI code in a separate Scene.
But then how are you supposed to give the UI Scene information like player health or score?
How would a pause button in the UI Scene tell the Game Scene to pause?
One solution is to pass data using events.
The easiest way to implement this is to use the EventEmitter instance from this.game.events but…"
Learn to code and lead your intrepid crew on a mission to save The Cloud in TwilioQuest, a PC role-playing game inspired by classics of the 16-bit era. Free forever, and available now for Windows, Mac, and Linux.
The first book on the creation of HTML5 cross platform games using Phaser 3 and other free software.
- By Emanuele Feronato
- 155 Pages
- 28 Source Code Examples
- Build a complete game from start to finish
- Cross Platform
- Scaling for devices