0
By learning, I am creating a very stupid "game" in C# and I make a bar the bar of life, but I need to decrease a decimal value and apparently the Progress only takes int values. How can I get her to present decimal values like 99.2%?
The Progress bar is defined naturally with a minimum of 0 and a maximum of 100. Line that makes the decrease in life:
lifeP1.Value -= (int)(ataque2);
No, you can’t change the type of the control variable. If it is necessary to increase the accuracy, you can increase the limit ex: 1000 and when displaying the information take the value and divide:
labelVida.Text = (progressBar1.Value / 1000d).ToString("P1");
outworking:99.2 %
.– Rovann Linhalis