How to create random scenes?

Hello there. I’m new with Gdevelop software so I have a simple question:
How do I create random scenes?
I mean, I have a Main Menu scene and 7 others scenes. When the games start I’m on Main Menu Scene then when I’m pressing “Play” button I want to play a random scene.
I hope you understand what I mean, thanks.

You need to create a variable like scene_name_number
Suppose you have 7 scenes so each scene named like Scene1, Scene2, …

What i do in this case is a randomInRange(1,7)
Begin of scene set scene_name_number = randomInRange(1,7)
add other variable to hold the scene name and number and assign like
var scene_to_go = ToString(“Scene” + variable(scene_name_number ))
Then last Change scene to scene_to_go

Look in my case all my scenes are named Level_0, Level_1, …

Hope this help.

3 Likes

Hi there, thank you so much for help, this was very useful, you’re a legend!!!

1 Like