Hey guys, hope you're doing good.
I appreciate in advance for your time.
So, I am making a player level system, and it's all good, except for the bar that shows the points (always the bar...).
I have a variable 'points = 0', a variable 'level = 0', a variable 'levelLimit = 100', and a variable 'levelLimitInitial = 100'.
When the 'points' are greater or equal than the 'levelLimit', I add 'levelLimitInitial' to 'levelLimit'.
And when the 'points' are less than the ('levelLimit' - 'levelLimitInitial'), I subtract 'levelLimitInitial' from 'levelLimit'.
In both cases I set the 'level' to (('levelLimit' / 'levelLimitInitial') - 1).
It means that when the player has from 0 to 99 points he is in level 0, when he has from 100 to 199 points he is on level 1, and so on. His level can be increased and decreased.
My striving now is the bar. I have a 'points' bar that is horizontal and have 1000 of width. I want this bar to behave like in the rpg games, when the bar is filled (when the points reach the levelLimit) you pass to the next level, and the bar becomes empty.
So, when the player has 50 points, the width of the bar should be 500; when the player has 150 points, the width of the bar should also be 500; when the player has 250 points, the width of the bar should be 500 again, and so son. I think you got what I mean.
The answer is there, inside my mind, whispering my name, but my bad math abilities obfuscate my vision. So if you got the maths, please give me a little hand there, will be much much appreciated.
Thanks in advance.
Isaac