I have a Scene 1 and a Scene 2. I am trying to use an event emitter to pass an integer variable called “playerShip” from scene 1 to scene 2, and then call a function called chooseShip() with that int variable as a parameter. Here is the related code so far:
Scene 2: this.scene.get('bootGame').events.on('update-ship', this.chooseShip, this);
bootGame is the label for Scene 1.
Right now I’m getting an error “Emitter is not defined,” referring to when I tried to create an emitter object in scene 1. This may be because I haven’t imported anything, but I’m not sure how to do that either.
I tried this method before I tried what I was doing now, but the error I was getting was that all my “eventsCenter” stuff was undefined. I think it’s because I couldn’t find a place to put the import statement " import eventsCenter from './EventsCenter'". Do you happen to know where this is supposed to go?