I was making a clicker game and I have no clue really what I am doing. I have nearly everything except I can't figure out how to make the money system the way I wanted to. I want to make it like the money systems in Cookie Clicker or Candy Clicker where it displays its amount in word terms such as "1.123 trillion" or "609.274 billion". Is there any way that I can do this?
Money System
- Edited
- Best Answerset by shark_lover1034
shark_lover1034 yes and no.
gdscript doesn't have the number of formatting options that python does, so for something like this you have to do it yourself, either through math or logic.
with logic is easier, you test wheter the number is higher than a number, like if the number is higher than one billion, then you have to combine the variables with text, for this you use the +
sign to concatenate words (is that the correct term?) and the str()
function to convert variables to text. finally, before printing your number, you reduce it to something smaller with simple integer division.
if money > 1000000000:
$myLabel.text = str(money / 1000000000) + " whatever this is"
elif money > 1000000:
$myLabel.text = str(money / 1000000) + " million"
Jesusemora Thanks, this really helped, time to spend the next 10 hours making the entire money system!!!!!!