Hi!
I’m currently making a simple plataform game which in order to finish it you have to complete all 10 levels.
I already made the 10 levels (10 scenes), and they are all accessible through the Menu scene. My question is: how can I keep only the first level unlocked and the other 9 ones locked? Or how can I unlock the next level by completing the previous level?
I know I can make like ‘if the player collides with an object at the end of the level, then changes the scene1 to scene2’. But I don’t know how to keep only the scene1 available/unlocked to access through the menu (right now you can access any of the 10 scenes through the menu).
I’ve searched a lot but couldn’t find any tutorial about this
Thank you!
Hi, try using global variables.
At the end of each scene, update the variables with your conditions that control completion of the level…
SceneOne … set global variable unlock_one = 1
SceneTwo … set global variable unlock_two = 1
and so on. In this case, the 1 stands for “true”.
Then on your menu scene events, set a style or animation for your buttons to show that it’s locked or maybe change the text to gray (I don’t know which one you’re using), but don’t link it to a scene unless…
Condition: global variable unlock_two = 1
Sub-Conditions:
- Cursor touch is on the button or text for level 2
– Left mouse button is down
Action: Scene 2 link
I hope this doesn’t sound too complicated and I think you will need to include the setting of the ‘unlocked’ variable from the previous scene at the beginning of the next one. :\
i would jump at the end of scene to next and add +1 to a global variable level, then at menu scene unlock as entries as this variable value.
Then you can store this value for next time you run the game
thanks to both Phenomena and xisco! It really helped me.
In case someone need one, I did share an example here (GDevelop5_level-selection-unlock.zip):
please tell me in brief…
please tell me in brief bro