Closed raphaklaus closed 6 years ago
tl;dr workaround: edit the lines, near the end of the app/scripts/scenes/splash-screen.js
module as follows:
// When the asset loader fulfills its job, start the Game scene.
scene.load.on('complete', () => {
this.scene
- .remove(scene)
+ .stop(scene)
.start('Game');
});
This problem appeared after Phaser 3.5.0. There has been a big code refactor of the scene manager, changing how scenes are registered and initialized. A few things got broken during that refactor, but were restored in 3.5.1 after I filed an issue. Not all of them, though.
That exception occurs during the game initialization, on the splash screen game scene. In that scene, a new 'Loader' scene is created, at run-time, to load the remaining game assets while showing the progress bar graphic over the (sample) cover. When all assets finish loading, that scene is discarded.
It all happens in rapid succession in the sample game because of the few assets included being loaded, you may only catch a glimpse of the splash screen being replaced by the spinning Phaser logo. Provided you follow the convention proposed to declare game assets (using the assets.js
module, still missing proper documentation :disappointed:), you should see the splash screen in action for a bit more time and the progress bar animating. Things won't improve with the addition of more game assets, however, because Phaser will not run that scene in time to initialize all its systems/managers.
I'll be looking for ways to fix the splash screen/loader combination before the next release of the generator. The whole thing feels too "hacky" and probably there are better ways to accomplish this without being too cryptic.
Thanks for reporting this one.
Ended up with a cleaner solution, easier to follow and customize. The sample SplashScreen
class will no longer rely on a parallel scene to load the game assets and the progress bar animation is just a sprite with a shape mask. No more magic!
Also removed the assets.js
module in favor of the regular Loader API methods users are more familiar with. There are not much documentation yet on this feature in Phaser as well, it's probably better to take it out.
All commits on master
branch.
When I install all dependencies and run
yarn start
it runs ok, but gives me the following console error:Uncaught TypeError: Cannot read property 'sys' of null