-1

I am making a game, the game works, but when I exit the console application, I want the game to save the user's progress, such as money and items they have bought. I am not sure how to, I am new to c++. Thanks for taking your time to read this.

cool bean
  • 11
  • 3

1 Answers1

2

To save progression you need to create a saveFile, you have to define what variables to save (money, items, current life, posX, posY,...).

You can define any readable file format like JSON :

{
     "player":{
         "life":26,
         "max_life":40,
         "bag":{
             "max_number_items":15
             "items":[..,..,..]
}

Or anything else like this:

<PLAYER>
max_life=40
life=26
</PLAYER>
<BAG>
max_number_items
..
</BAG>

And then on load, you have to read your file to get back your data