I'm trying to figure out how add to a Final Score variable so the duration is always the same regardless of the score.
ie. You beat the level and your score is 12,000, in 2 seconds your Final Score meter will go from 0 to 12,000 increasing by x.
Currently I'm just using "add 100" to Final Score every tick if Final Score variable =/ Score variable. and then when the final score is over it sets the text to the score variable. Obviously this isn't timed like I want it at all, and I'm having trouble figuring out where to start...
Any help would be greatly appreciated!
Thanks.It's pretty easy.
Forget about all technical background information and just remember this:
When using dt ("delta time") on every tick, then everything you multiply with dt will result in the exact portion you need in this tick in order to reach the full result after one second.
You're aiming for two seconds, so you'd need half the score
6000 * dt => portion for this tick to reach 6000 after 1 second
Now just add it to a current score variable on every tick, and current score will be 12000 after two seconds.
on every tick -> add 6000*dt to current
current = 12000 -> do final score
If you want to be absolutely sure you can also use min():
on every tick -> set current to min(current + 6000 * dt, 12000)
this will prevent raising the score after reaching 12000
rule: number * dt = amount needed per tick to raise to number within a second