Is there a way to send data over from a Child scene to a Parent or Sibling scene? I have three scenes in 3 different .ts files like this:
GameScene.ts (Parent)
----->SceneA.ts (Child)
----->SceneB.ts (Child)
The GameScene starts both the scenes. I know that you can send data from the parent to the child doing something like this:
this.scene.start(‘sceneA’, {test: “hello”})
… but is it possible to send data the other way (from sceneA to GameScene)? I also thought of using something like…
this.scene.get(‘sceneA’).myFunction
…to maybe call functions to grab data, but I always get a warning in my editor (VSCode) that says “Property ‘myFunction’ does not exist on type 'Scene’” and the only way to fix it is to declare a property/method in the phaser.d.ts. This seems fine to me, but is this the “proper” way to do it?
I just started Phaser a few days ago so it’s possible I’m designing my game wrong. I thought it would be a good idea to split my scenes into separate scripts.
EDIT: Post #6 by @Milton also shows an alternate solution.
// level scene
this.events.emit('upPoints' /*…*/);
// HUD scene
this.scene.get('Level_One').events.on('upPoints' /*…*/);