Advice on scene structure for multiple levels

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By vbdev

Hello everyone,

Game description:
I am developing a puzzle game which involves multiple levels. Each level will have different background (static bodies with sprites & collision areas) & different objects (awards like coins, keys etc. & different types of enemies) -area2Ds.
Some levels may have same background but different number of emenies & their locations.

I have decided to make a number of scenes like room1, room2 etc for different backgrounds - sprites with Collision areas.

There will be different level scenes like level1, level2 etc. which will have a room scene as its child and some objects according to the selected level.

There will be one MainScene, score information on the top & some buttons at the bottom. It will have a particular level scene as its child depending on the selected level.

In short, MainScene will have a particular level as its child, and the level will have particular room as its child. My question is that, is the above approach correct for such type of games or am I doing it wrong way, please advice. Thanks.

:bust_in_silhouette: Reply From: magicalogic

Create each level as its own scene and do the same for the other objects (enemies, coins…). If however your levels have a lot that doesn’t change it would be better to create a generic level and inherit the other levels from it. The idea is to avoid repetition as much as possible.

For the main scene(which I take to be the HUD), I think it shouldn’t have a level as a child but be a child of each level (its more logical that way)