- #1
Nanako
- 39
- 0
hello everyone. I need a little help with something probably simple, for a game engine I'm writing.
I want to reduce a number n by a certain percentage each second, p.
But i want to do this with higher granularity, depending on the framerate my game is running at.
So for example, if i want to reduce a 100 by 5% per second, and I'm running at 30 frames per second, How do i calculate what to multiply the number by each frame, to achieve that.
To make it clear, I'm looking for a compound reduction here. ie the sequence after 0, 1, 2, 3 seconds etc, would be 100, 95, 90.25, 85.735, 81.45, etcetera.
I want to reduce a number n by a certain percentage each second, p.
But i want to do this with higher granularity, depending on the framerate my game is running at.
So for example, if i want to reduce a 100 by 5% per second, and I'm running at 30 frames per second, How do i calculate what to multiply the number by each frame, to achieve that.
To make it clear, I'm looking for a compound reduction here. ie the sequence after 0, 1, 2, 3 seconds etc, would be 100, 95, 90.25, 85.735, 81.45, etcetera.