As per the title. I'm still learning on how to do things with Construct 3 and one of the things I want to learn about is making a clicker game. I've been playing around and I eventually ran into this problem where the numbers would simply explode on screen.
Referring to many of the clicker games, they simply change big numbers into alphabets. Like 1,000 into 1 K, 1,000,000 into 1 Mil, 1,000,000,000 into 1 Bil, etc.
My question is how do I go about coding this with C3?
I cannot for the life of me figure this out...
Any help provided is appreciated!
Develop games in your browser. Powerful, performant & highly capable.
The easiest solution is just check if the value exceeds a boundary, and the divide it.
So if value is greater than 1m then divide by 1m and round the value. This also has the nice side effect that you know which suffix to put on it. It's important that you round the value, or you will get decimal points stretching off into infinity instead.
A downside to this approach is that you lose the fractional part of the value, but you can solve it with a slight adjustment. Try dividing by 0.1m, rounding the value then dividing by 10. This will give you the same value, but with 1 decimal place. You can do the same with 0.01 and 0.001 as well if you want more decimal places. Here's an example for you.