Gdevelop wallet

Hello guys, i am planning to make a game where the score you made will become a wallet sold, what is the best way to do so? Let me explain:
You play and make 100 score, wallet sold = 100
Play again and make 150 score, wallet sold 250,
And after that, i make a shop where to buy things with the sold i made.
I am thinking of making a variable wich i set to the score, at the end of the scene i write that variable into “sold” into storage “game” for example.
After a purchase i rewrite the variable -price of item.
I want the sold to exist even after i quit the game.
What do u think? Thanks.

Hello @Naka
I suggest you to prepare a structure variable with all the informations you need to be stored.
Then parse the structure in a JSON flat string and store it.

Here you’ll find usefull examples links.

Bye,
j

2 Likes

I suggest the Storage “Read a value” action when starting the game to load the wallet and “Write a value” action when the amount changes.

2 Likes

so, i made it so far, but when i quit my game and enter it, the “sold” of the wallet is correct, but if i play and then come to main menu where score is showed, the “sold” resets and it is shown the new score that i made. What i have to do that the main “sold” is kept and the new score will be added to this variable? not reset variable instead add the new value to it. thanks

1 Like