Currencies¶
To determine the value of an Item, Game Creator uses the concept of Currency.
A Currency is an asset that contains one or more Coins. Each Coin has a value relative to a single unit. To create one, right click on the Project Panel and select Create → Game Creator → Inventory → Currency.
Single Currency
Most games make use of a single Currency. However, some mobile games and hard-core resource management games use multiple ones.
In the example above, the Currency just has a single Coin called Gold which value is 1. This is the most simple currency one can create and it's the most commonly used in most games.
No decimals
It is important to note that a currency cannot have a decimal value. If you wish to represent a value with 2 decimals, one can multiple the value x100 and then shift the comma two units left.
However, some games make use of a multi-coin Currency where each coin represents a different value.
Copper, Silver and Gold
Let's say we are making a game where the currency has three different coins, each with a different value:
- A Copper coin is the smallest one.
- A Silver coin is equal to 25 of Copper coins.
- A Gold coin is equal to 5 Silver coins.
In that case, we would create a Currency asset with three coins:
- Copper: Is the smallest possible value, so it has a value of 1.
- Silver: Is equal to 25 copper coins, so it has a value of 25.
- Gold: Is equal to 5 silver coins, which cost 25 copper coins each, so it has a value of 125.
It is important to note that when adding or subtracting a value of a particular Currency the value used is relative to the unit. Following the example above, if we want to give one Gold Coin to the Player, we simply increase its wealth by 125.