Ok, sorry to hear that.
Did you try to rename your Scenes without spaces like Level_1, Level_2 etc.
Then is a good practice too if you pretend some action to run one time add Trigger Once in your conditions.
You can try something like this
worked like that, but i think in that exemple gdev he’s only using the bolean variable to change to level 2. if i delete “read save” etc, it sitll changes. (i need gdev to read the save to know which level to go)
Sure if you did change the global before it will work without reading the Storage.
I thought that wanting to read Storage was for another reason.
Whenever you change the value of the global variable during the game, it will remain even if you change the level, that is, even if you move from level 1 to 2, if the global variable levels is equal to 2, it will always be 2.
The logical thing is that when changing the level you save or increase the number, using two global variables as control, one for the current level and another for the next.
Look what I do in my game.
One variable for current level and other for next_level or max level reached.
So it’s easy to move between scenes.
So when I need to go to the next level when my player collides with the end door and press Up. I do this checks events.
yeah it’s 2 when you go from 1 to 2. when you go from 2 to 3 it’s 3, etc. i have add 1 when player hits end (first screenshot).
would it be possible to show in your game how the events look in start menu to load to the last level you were in, say level X (if that makes sense)
This is how I do the action variable change it number based on the button you click in main menu then check if action = 1 or 2 or 3
thank you. i like that ideia of level_+etc
tried but didn’t work. does this look ok? my letters aren’t green.
Also is there a way on dev tools or something to know the value of a global variable at any given point?
Your letters aren’t green because of the UI theme you are using. As for knowing the value of a global variable, you can create a text display and change the text set to the global variable. I don’t think there is another way of knowing the current value of a global variable.
I have no idea why it isn’t working for you.
Hi try to move the changelevel_sv comparison outside the event as a single comparison event and add Trigger Once,
So when you click the button just change the variable Levels and changelevel_sv
Then comprare like you’re doing and add Trigger Once
Condition:
The boolean value of changelevel_sv
Trigger Once
Action:
Change Scene “Level_”…
For you to check the variables and Scenes, Objects etc, you Run the game From Debugger just right click the bug icon
Once your game start click Refresh and navigate to Scenes variable ot Global variables
Sorry i didn’t understand wht you meant by this “Hi try to move the changelevel_sv comparison outside the event as a single comparison event and add Trigger Once,
So when you click the button just change the variable Levels and changelevel_sv
Then comprare like you’re doing and add Trigger Once”
Also, after i click resume and hit refresh, this is what i got, levels_sv is stayin on 0, which is wierd because in that screen before we can see the storage correctly at “2”
Hi you don’t need to use Read from Storage on that click use the Read from Storage on the begin of the scene just to set the levels_sv value then just change the values of your variables and use the variables.
Look my events I use Read and Write at the begin of the scene one for game_level and other for max_level_reached and assign those values when the game starts.
Later I only need to change the variables and save into Storage
In my case the change of the variables trigger when the player is over the end door and press Up.