phaser.js:3090 Uncaught TypeError: Cannot read property 'sys' of undefined
after changing scene.
What I can see is that the scene property of my sprite object is undefined. When it works (before I switches scenes) the scene property of my sprite object is PlayScene.
I have seen in the “drag scenes demo.js” example that the scene classes constructors begins with:
First from my MenuScene to the PlayScene which works fine, but when going from PlayScene to ScoreScene and then back from ScoreScene to PlayScene I get the crash.
I think I get whats wrong now. I should wait for the create() method to create my sprites again. I thought that they were coupled to the scene and that you don’t have to create them every time you switch scene, but now I think I were wrong.
It turned out that I couldn’t use the this.scene.switch(‘SCORE’) method, because it sends no parameters to the init() function, the init() function gets called though, but the parameter is set to {} and I needed the parameter. I found no other methods to change scene that matched my which so I rewrote my code using this.scene.start() and took the penalty of doing preload() and create() again.