How do I Show 10.000 as 10K etc

Get help using Construct 2

Post » Thu Jul 17, 2014 9:10 pm

Hi all!

I am creating a game where i use big yet huge numbers.

Even to billions. Ofcourse i can't display: 10.000.000.000.000..
Well.. It's possible but i don't want to.

Is there any way i can display:
1.000 as 1K
50.000 as 50K
1.000.000 as 1M
1.000.000.000 as 1B etc?

That also raises my question, is there in construct 2 a limit for the amount of numbers in a global variable and webstorages?

Thanks in advance!
B
10
S
4
G
3
Posts: 169
Reputation: 2,519

Post » Thu Jul 17, 2014 9:20 pm

Would something like this work?

if variable > 1000 set text: round(variable/1000)&"K"
if variable > 1000000 set text: round(variable/1000000)&"M"
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Jul 17, 2014 9:21 pm

@littlestain yes it will work, tried it before. Good job for finding the answer! :)
ImageImageImageImageImage
B
56
S
15
G
5
Posts: 852
Reputation: 11,446

Post » Thu Jul 17, 2014 11:30 pm

As for the maximum number, I think C2 can really go far, but since it is using floats, the precision might be affected when you go really far into big numbers, I think the maximum UID number is somewhat close to 9 000 000 000 000 000 and I would assume so that the maximum accurate integer value would be around that, but it could be larger (still pretty high anyway)

As for the solution @LittleStain suggested, I would recommend doing a function that will format it the way you want, by comparing the number of digits the integer value of the number have.

Edit: also you might want to use the Internation system prefixes if you go really high (k ; M ; G ; T ; P ; E ; Z ; Y)
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123


Return to How do I....?

Who is online

Users browsing this forum: Lancifer and 14 guests