Need help with save system

i did but i want it to save the game when you leave to.

yeah I fiquerd it out (how the save thingy starts but anyway) soo umm I have edited a little bit of the code so you don’t restart the level whenever you go on a deadly tile cause then what’s the point of health so yeah I was thinking help with it restarting the level on the on life zero block I tried to get it to send the player with the call what level block but it did not work so maybe I could help with that.

the updated code: banana bonanza

Who is this replying to?

hey @richard umm so do you think you can explain to me (with images or just do comments on the blocks) how I can have the game auto save when you leave the game if you can cause idk how and I need it for the game cause it is gonna be a pretty big game and u want ur proggress to still be there when u leave so yea hope I made that clear I hope you can help cause I think you made this extension so I think u can work it (and pls make it in the current game here: this is banana bonanza my game now pls HELP!!!

its replying to @xInsqne1

1 Like

i’m not going to code it for ya’, but i’ll point you in the right direction.

to save stuff you need to use the “settings-blocks” extension. this lets you store numbers, strings, and booleans in a way where they will persist even if the user restarts the game.

the basic code for saving your game will probably look something like this:

inside on start, you want to check to see if a save file exists. if so, ask the player if they want to continue or start a new game and then continue from there.

inside your saveGame function, you want to save all the variables of your game that you’ll want to restore. for example, you might store what level the player is on, what items are in their inventory, etc. you’ll want to call this function whenever the player does something that should be saved (beats a level, opens a treasure chest, talks to an npc, etc.)

then, inside your startGameFromContinue function, you can read those values out of settings and setup all of your variables again.

2 Likes

thanks

to do that you could have a forever block that always saves progress, rather than when the player leaves.

1 Like

I can try that I dunno cause someone else was helping with that

but thanks @VoxelMaster64

1 Like