Right now I'm working on a platformer, and I need it to save how much corn(money) u have and what levels u have unlocked. What I doing is when u boot the game up to the start screen it saves the game, then it loads it's save. And it save data at the level complete screen and when u reach a check point during the level. The reason I don't just have the game load a save when u start the game is because it'll toss u into a level right away and when u go to the main menu from anywhere in the game it'll just take u back to the continue screen or the middle of a level. However if I don't load the save on start up then u won't have any money untill a save is loaded. And since I can't load the save on start screen idk what to do since save on start then loading that doesn't work either. Doing that just resets the save data for some reason....
Develop games in your browser. Powerful, performant & highly capable.
Depending on what exactly you need to have saved the save function might be a bit overkill. I never really used it but iirc it acts like a snapshot of the entire current gamestate (like the one you can make in the debugger) that saves pretty much everything, unless you specifically give it the "no save" behavior.
In your case you only want to save money (number) and a list of levels that are either locked or unlocked (Array) so what you can do is use local storage and just save/load the data. This will also make your saves much smaller, since you only save exactly what you really need.
Okay thank you so so much, I suppose the actually function will allow me to choose what saves and what doesn't ?