[Solved] Is there a way to switch to a new scene using a variable for scene's name?

I’ve asked this on the FB group, pretty much gave up and created a game_over menu for each level in my game, but while I’m here, and searching other posts answered my first question…

I want to use scene (or global) variables for CurrentLevel and NextLevel, so at the point where the player has the option of restarting or exiting, they can also have the option to move to the next level using, for example, something like:

  Change scene to ToString(Variable(NextLevel))

The reason I’m asking is, where more or less everything else has an option to use a variable for the value to set it to, the same option (at least, as it exists for other stuff) isn’t there. Is there an alternate way that this could be done? Or do I just have to create multiple scenes for game_over, one for each level (as I gave up and did)? I’d prefer to do it the right way, if there is one.


An example from my project:


In my first game, I have one scene for player death/game over. The scene change is triggered via a health status condition like player.Variable (health.current) = or < 0 change scene

All of the scenes have id #s as well, which changes a global variable named Scene at the beginning of every scene. A try again button is programmed to return you to the last scene if you die.

I’d post some screenshots but am mobile now.

Ok, I just tried entering that directly and it worked…for a change. Never let me do that before, just sent me to the usual (where entering it manually also worked). Too easy, too obvious … and that’s probably why I didn’t see it. :slight_smile: Thanks!

1 Like