I am trying to make a Cookie Clicker-like game using libGDX in Java. In Cookie Clicker games there is something called cPs, which is cookies/points per second. And that number can be huge. But instead of adding X points per second, the game is adding 1 point X times per second.
I am trying to do same thing using double variables. It looks something like this right now:
if (deltaTime > (1/pointsPerSecond)) {
score += 1;
deltaTime = 0;
}
But with numbers like 300 points per second, the counter just can't keep up with adding points. What is the best solution to this?
Thank you all for your help.
I manage to do it by dividing my point per second by 30 and adding them 30 times per second instead of adding them XXXX times per second 1 by 1 point. This way it looks like points are constantly increasing.
Have a nice day every1 :)