# Points Bar with Level ?

0 favourites
• 4 posts
From the Asset Store
Custom animated Health Bar - check youtube video to make it yourself
• Hey guys, hope you're doing good.

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.

Isaac

• I kind of understand what you want, it's been asked before, but then you've confused matters by saying the bar must be 500 and 1000 width, it can't be both.

• I understand it like that: if the player has 50 point the bar is in the middle at 500 pixels from the 1000 pixels maximum, if the player has 150 it's again in the middle.

Try to set the width of the bar with modulo: ((Score-1)%100)*10

Every time the player is over 100 Points (Score) the bar should be set back to 0 and 1 point are 10 pixels on the bar.

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• , I mean the maximum width of the bar is 1000.

Asmodean , that's exactly it. Very neat. It's done, thanks :)

• 4 posts