Emit Events Across Scenes

samme, etc

Good code, but brittle architecture,
Why make your HUD responsible for knowing what scene is active or which might be sending signals?
Why not add this to any scene that needs to report to the HUD?

// declaration
this.HUDevent = (e, data)=> this.scene.get('HUD').events.emit( e, data);

// usage
this.HUDevent( "score", points);

2 Likes