What's an efficient way to change levels?
In my game I plan to have 100 levels. So far I have designed 22 levels.
Before the player goes to the next level, they will see a score screen for the level they just completed.
I have hardcoded checking a global variable that stores the name of the level they were just on, and then going to the next layout.
But when you plan to put in 100 levels, having 100 lines of code just specifying the layout to go to makes me feel yuck and I'm convinced there's an easier way to do this.
I thought that perhaps I could change the levels to just numbers and then set an increment the numbers where needed but the problem is I cannot "go to layout (by name)" just by setting the value to my global variable number that keeps track of what level the player is on. It has to be a string.
What's the best way to do this where I don't have to put 100 lines of "system g_Level = "Level_<levelnumber>" - System Go to Level_<levelnumber>?