I ended up making the “all levels” section it’s own scene. I just realized that the darkened area of your screen grab has the actions as child actions of things from the “you won” screen.
How can I make it work on it’s own scene?
I tried putting the following at the end of each playing level, but it isn’t changing the level selection scene.
I’m assuming you’ll have a “you win” scene, which opens up a level selection scene?
If so, put the event setting the global variable max_level_unlocked in the “you win” scene, and take it out of all the level scenes.
Then, using my screen snip a few posts back, put the events from the second comment onwards into the level selection scene, along with buttons for all the levels.
Don’t set max_level_unlocked here. Do that in the “you win” scene.
Now when I finish the first level, it unlocks the first 3 levels. (I just want it to unlock 1 and 2 at that point), but when I finish level 2, only 1 and 2 are unlocked, when I would think 1, 2, and 3 should be unlocked at that point.
I put the max(GlobalVariable(max_level_unlocked),GlobalVariable(current_playing_level) +1) in the “at the begining” section of the “you win” scene. Is that a good place for it?
That was already like that, but I went ahead and changed the repeat to be a subevent of a “at the beginning” like you mentioned. But it’s still doing the same thing. No levels are unlocked until after the first level is cleared (so you can’t even play the first level by clicking on the “Level Selection” screen, and after you complete the first level, it unlocks levels 1-3. Even though you haven’t finished the second level yet.
Set max_level_unlocked to 1 in the editor, in the global variables definition (in my screen screen snip back a way it’s set to 0, change t to 1). This’ll unlock the first level.
This points to 2 places where it’s increasing max_level_unlocked. Can you provide screen snips of the level selection scene events, level1 scene events and the “you won” scene events? It smells like it’s double dipping somewhere.
I looked really closely at all the actions and the variables that related to all of this and realized that I hadn’t updated the one related to what each level was numbered. I had decided that the level I made as level 1 had gotten harder to play and would work better as a level 2, but I hadn’t updated the variables so level 1 was listed as #2 and Level 2 was listed as 1.
Now everything works! Thanks again for all the help, @MrMen
@MrMen I spent hours pouring over videos and tutorials trying to understand how to store the levels the player has unlocked, and I am very confused.
Should I write a value to storage of the max_levels_unlocked (global variable), and save that to storage? If so, do I do that at the very end of the “you win” scene and then read it on the “level selection” scene? I feel like I’m close to understanding this, but I’m not sure.
Write it to storage in the same event you write all_level_times. It’s not the perfect place, but then you have your write events together.
Yes, you can read it there. Make it one of the first events in the scene.
The other option is to read it at the very start of your game, in the very first scene that opens the game. It only ever needs to be read n once. After that, it’ll get updated and be correct throughout the whole game.
But when I run it in preview mode, the levels unlocked worked with out writing or reading anything to storage. I want to check and make sure it will remember the unlocked levels even after the game is closed.
Are you saying that each time I run a new preview it should remember the saved levels info? If so, then I did something wrong because that is not what is happening when I open a new preview.
Make sure when you run from the editor, you have the start scene open and in focus in the editor. If you have a level scene open or in focus, that will get run instead.