hey guys its me again lol , my game as a high score and i have that set up along side of the normal score which both work perfect but i cant figure out how to save the high score , and also have it save automatically when the player dies and them not having to hit the save button, any ideas?
Use a global variable to store the high score so the value stays at the last updated value even if the scene is restarted.
But it won’t retain the value when the game is turned off. For that you need to use the File System feature to store the value containing the high score in a JSON format.
Adding an action to save the value when the player dies and loading the value from the stored file at the beginning of the scene should work.
thank you ! i will try that now and also one more thing when my character the ball hits the cactus i want it to change scene because its died , but i put in events collison ball collision with cactus
and change scene to “level2” however nothing happens it wont change the scene when ball is in collision with cactus ? am i missing something
Please send a screenshot of the event Thanks
Make sure the scene name is within quotes(in the action).
I see two events checking the same condition, which is cactus and ball colliding.
Keep only one of them and move the extra action to the remaining one.
i tried that before and it still didnt work thats why i made the new one , but i have deleted that one and added the action to the other and it still doesnt switch scene on preview mode
I hope both the scenes have different objects else you won’t be able to distinguish between them
my other scene i have just added the background of scene 1 as it will be a try again screen to go back to the main screen the game
I don’t know if this will help you get the result you’re looking for on changing the scene, but I think you only need one “at the beginning of the scene” condition; make it the first thing in the sheet and you can put all of the actions that you want to be triggered then on the same line.
Also, if you ever want to preserve some line of code for any reason when you’re trying to get something working, you can right click to “toggle disabled”. That way, you can easily restore (right click “toggle disabled” again) if you need it later. Then if you don’t need it, delete it.
thank you ive sorted all that but i still cant figure out the change scene lol ive seen videos and they just put if a object collides with this object , change the scene but mine just dont work no matter where i put it
I went on to scene 2 and added just a background and tried to get it to switch to main scene so the other way around and even that dont work i dont understand what im missing lol ? im pressing the blue play button at top to preview it ? is there something else i need to do as i saw a vid that said compile them first but i think that was for the old gdevelop as i cant see a button to compile it
I feel like you have entered the wrong scene name (it is case sensitive). The tabs always show it in caps. To check the scene name, go to the project manager.
omggg hahaha that fixed it lol thanks for that !