How can I keep my game in one scene?

How can I keep most of my game in one scene?

Scenes aren’t infinite, and even if they were infinite, I can’t load in the whole entire game layout in one shot, so how can I load a piece of the game in one scene (like a level in a platformer) without moving to a new scene?
I don’t want to change one thing and have to make the same change in every other scene that needs it.

It sounds like you want to use external layouts. You create each level as a new external layout, and one scene with events. Use that scene to create the objects from the external layout. No need to repeat the events, and the objects are shared between the external layouts as they belong to the scene.

2 Likes

Hi,
You can for example have a variable “stateofthegame” or “currentlevel”
Everything can be in same scene, managing it with this variable as a condition.
For ex:

  • if VariableString(stateofthegame) =“menu”, then all the code for the menu.
    Or
  • if Variable(level) =1, then code for level one.

Etc.

However, usually, external events and external layouts, with one or several scenes, and also use of global variables, can help a lot in this case of multiple levels. Other people know more about that, and that can be found in previous threads here on the forum.

Edit: reading your post again, it definitely looks like @MrMen solution is what you’re looking for :))

2 Likes