Phaser3 Multi Levels

For multiple level using different scenes, can I use back the SAME this.player or this.map or should I use a different this instead ??

Thanks

What?

Can I use back the same variable on different levels on different scenes ??

Yes, there are many ways to do this. The easiest and always working solution, regardless of how you have designed your code, is to use the data registry in phaser. Each scene and also the game has a data registry. Use the game registry and you can fetch the data directly from any scene.

Here is an example http://labs.phaser.io/edit.html?src=src/scenes\registry%20data%20exchange%20es6.js

Search on labs for more examples.

Thanks…

Or should I have a preload Scenes and load up ALL the required assets from a single scene files and remove the redundant preload in each and every levels …

This uses one boot (preload) scene and the data registry:

2 Likes