This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

How can I code something like this?

If my money reaches 1,000,000,000 which is 1 billion it will reset the digits to 1 and add a letter B on the side. after that, if the money reaches 1,000 Billion, instead of adding the 4th digit, it will reset again to 1 digit and change the word to trillion.

in Engine by (21 points)

You want to separate value (number) and visualisation (label). So have money stored in a numeric variable, which you can Increment when needed and in label part, that you show to user. In label part, you can have multiple conditional statements.

var billion = 10000000000
var trillion = billion*1000
if int(money / trillion) > 0:
    label = str(int(money / trillion)) + "T"
elif int(money / billion) > 0:
    label = str(int(money / billion)) + "B"
    label = str(money)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.