I have a game that has multiple levels, and not all the assets are used in one layout. Is there any performance benefit or drawback if I have multiple layout per level. I create object instances that I only use in a given layout, so instead of squeezing everything in one layout i plan to create them separately. Thanks.
Develop games in your browser. Powerful, performant & highly capable.
Each layout is a level for the most part. Or each layout can be a part of a level. Anything that needs to be persisted between layouts should be tracked with global variables. It is advised to have one layout that has a copy of all your sprites (one that the player never actually goes to) so that you can spawn instances of sprites without any errors. You cannot spawn an instance of a sprite if it does not exist in at least one layout. So create a sandbox layout, put one copy of each sprite in it and then just never let the player go to that particular layout. You can then use events to spawn instances of any of your sprites in any of your other layouts without issues.
The manual and basic tutorials cover all of this in pretty good detail so I definitely recommend going through them. Hope this helps.
It probably makes no difference.
thats not affect performance like ashley says
and on every end of layout there is clean memory and destroy all object
i prefer to create a lot of layout than one layout with multiple and complicated script and object