I want to do a save and load system for my game, but i dont know how, my design is like this:
The game detects player has died, meaning the value associted with health is equal or below 0
The game decides to check for the final score at the moment of death
The game writes down in the JSON files the final score in a list of final scores
The game also writes down the amount of coins won based on the final score, (which is pretty much if you get a final score of 250, you get 250 coins) in a history
The game calculates how much coins the player has based on its history, Ex: this player got 50 coins, then spent 25 coins, then got 50 coins so he got 75 coins right now)
If: player spends some coins
the game will add the transaction to the save file in a history
the game will then do yet another calculation