its my first time using a ProgressBar in c#.
The idea is to use the ProgressBar as an health bar in a simple game.
The thing is I think the bar’s maximum value is 100% but i would like to give it a higher value like let’s say 1000% or, not sure if it’s possible, give the bar an integer value instead of a percentage.
progressBar1.Increment(100);
This is where I initialize the health to 100points. Even if I use this syntax:
progressBar1.Increment(1000);
And I subtract :
progressBar1.Increment(-25);
The player is loosing 1/4 of is life as if he only had 100 Health Points.
Any idea how I could change the maximum Bar value?
Thanks in advance.
You should have another variable that holds the player’s health. Storing the health data just in the control would not be a good idea.
You could do the following:
You then update the variable
actualHealth, which could be over the maximum control range of 100. You could then change the control’s style or another visual element to show the player is “buffed”.