Confused about scene management

I have this big project that I am starting to work on and it’s a game with 10 levels. I suppose that I can treat each level as a scene. Is this correct?

So I’d like to know how to manage my code and the assets in this scenario. From my perspective the ideal way of doing it would be having a controller code which will carry game data (score, scene number or name, etc) and a separate code for each level to loaded as needed. For instances the game would start loading the level 1 (scene 1) assets and code. So once the player move to level 2 it would load the assets and code for level 2 (and ideally unload the level 1 stuff) and so on.

However I am completely lost and have no idea how this dynamic works in Phaser. I tried to find a simple tutorial but couldn’t find it. I would appreaciate for some directions, tips, examples, etc. A good tutorial is also welcome (preferrably NOT using npm stuff).

Thanks!

You can pass game data needed for the particular scene when you start a scene. You will get that data in init method of the scene. and there is preload method of scene using which you can load assets required for that scene. and when all assets are loaded create function of the scene will be called.

You can also use separate scene for UI (e.g. score ui, timer, etc). So, you don’t need to create that in every scene.

1 Like

Thanks @theNeedle! I will check your tips! :grinning: