Easy random level switch

Hey guys! So I’m planning to make a game that chooses a random level, but there is one problem:

I want a easy way to switch to a random level without having a bunch of code. But then I remembered I was following a brackeys tutorial on how to make a game in unity, and I found out every scene in unity has a index and you can change the scene to the index of what scene you Want. Is there anyway to do it in gdevelop?

There isn’t an accessible scene index, but you can pretty easily make the same concept by using a uniform naming scheme plus a number.

So if you have five levels, just name the scenes Level1, Level2, Level3, etc

Then set up your change scene event to change to the “Level” + ToString(RandomInRange(1,5)).

The event will see “Level1” through “Level5” depending on the random number.

OK thanks for the reply I’m going to try it.

1 Like