In-game currency store coding

So I am new to coding and I was wondering if there was a tutorial or guide out there to code in a store in game to buy things like extra skins for the character using in-game currency? I have been searching but haven’t found anything so I am sorry if this topic already exists. Any help would be appreciated. Thanks! :slight_smile:

@jtubbs,

There is no single way to do this, so I don’t think there will be any tutorials on the subject.  In fact, the answer to this question involves a number of topics.  

Let me see if I can get you started.

  1. Decide what your currency will be called: Gems, coins, dingbats, … you get the idea.  

  2. Decide how you want users to be able to acquire this currency:

  1. Once you have this list of ‘actions’, learn how to code them up.  Links given above to get you started, but each of these may be a deep topic.

  2. You will also have to learn how to save data and keep track of data: https://docs.coronalabs.com/tutorial/index.html#data-files-strings

Several great starting places for all questions are:

Tutorials: https://docs.coronalabs.com/tutorial/index.html

Developer Guides:  https://docs.coronalabs.com/guide/index.html#developer-guides

API Docshttps://docs.coronalabs.com/api/ 

Plugins Page (for features to enable above): https://docs.coronalabs.com/plugin/index.html

Market Place  (for more features to enable above)https://marketplace.coronalabs.com/

Note: I only focused on the in-game currency and earning it.  

I totally failed to answer the ‘in game store’ part of the question.  Hopefully someone comes back with an answer on this.

Completely ignoring IAP here. 

Assuming you know exactly what your store is going to look like. You’re going to have to worry about two main things

  1. Make sure the player’s currency is saved before visiting the store.

  2. Make sure the proper amount of currency is removed from the player, and the new currency and item bought are stored. 

Personally, I recommend saving the currency and items using a .txt file. Have one for currency and another for items purchased.

A .json file would probably be better though.

Thank you guys so much! I will try those out. I am still pretty far away from putting that into the game but I wanted to get an idea of what to expect to begin thinking about it. Thank you again! :slight_smile:

@jtubbs,

There is no single way to do this, so I don’t think there will be any tutorials on the subject.  In fact, the answer to this question involves a number of topics.  

Let me see if I can get you started.

  1. Decide what your currency will be called: Gems, coins, dingbats, … you get the idea.  

  2. Decide how you want users to be able to acquire this currency:

  1. Once you have this list of ‘actions’, learn how to code them up.  Links given above to get you started, but each of these may be a deep topic.

  2. You will also have to learn how to save data and keep track of data: https://docs.coronalabs.com/tutorial/index.html#data-files-strings

Several great starting places for all questions are:

Tutorials: https://docs.coronalabs.com/tutorial/index.html

Developer Guides:  https://docs.coronalabs.com/guide/index.html#developer-guides

API Docshttps://docs.coronalabs.com/api/ 

Plugins Page (for features to enable above): https://docs.coronalabs.com/plugin/index.html

Market Place  (for more features to enable above)https://marketplace.coronalabs.com/

Note: I only focused on the in-game currency and earning it.  

I totally failed to answer the ‘in game store’ part of the question.  Hopefully someone comes back with an answer on this.

Completely ignoring IAP here. 

Assuming you know exactly what your store is going to look like. You’re going to have to worry about two main things

  1. Make sure the player’s currency is saved before visiting the store.

  2. Make sure the proper amount of currency is removed from the player, and the new currency and item bought are stored. 

Personally, I recommend saving the currency and items using a .txt file. Have one for currency and another for items purchased.

A .json file would probably be better though.

Thank you guys so much! I will try those out. I am still pretty far away from putting that into the game but I wanted to get an idea of what to expect to begin thinking about it. Thank you again! :slight_smile: