Hi ya Gdevelop community.
So I am trying to learn how to add in game-currency into my games.
For example
The player can collect coins (WHich they count as points and as currency)
The player can then use those coins in other scenes (shop for example) in order to buy skins or other characters etc…
I don’t know why but I expected this to be really simple, and yet here I am asking how to do it cause I fail to make the currency function work properly between scenes.
I want the total coins to remain after closing and reopening the game. (Same with the bought items such as skins etc)
Can someone advise a good tutorial that will help me with this? Or is there anyone willing to share their in-game-currency file as an example?
To save data after closing the game, you’ll need to use a storage option. See the wiki page on Storage for details/examples: Storage [GDevelop wiki]
1 Like
Hey thanks for the answer.
So I messed up a bit with the storage functions but there is something that I can’t figure out
These are the commands associated with the game currency
SCENE 1 - BASIC GAMEPLAY
Basically each time you collect a shape you get a point (I have other commands for the points) and one coin
SCENE 2 - SHOP
By using the above commands I managed to create an in game-currency that remains when the scene changes. Say you collected 50 coins you can see the amount in the first scene and you can also see it in the shop scene.
BUT
When I reset the game and run a new preview the in-game currency goes back to 0
I am also using the below commands for an In-game Highscore tracker and it works fine when I reset the game.
I would really appreciate some help here since with my current Gdevelop knowledge I have no idea how to fix this issue… Thus the reason that I wanted to see some examples from other creators.
UPDATE
So I kinda solved my issue
Basically, I added the below commands/actions at the start
And this right at the end
For now my in game-currency works fine, but I ended up creating another storage folder which seems unnecessary to me. There’s gotta be a simpler solution that I am missing.
Anyway, if someone can advise a different solution I would really appreciate it.
1 Like