How to calculate percentages
![Post Post](styles/prosilver/imageset/icon_post_target.gif)
I have a method on how to calculate the percentage of something, ok, say you have this method
HP: 0 / 800
Make a variable called detector, and perentage, now, in the detector, use this method
The value 800 was stroked down to 8, if it was 8000, it'd be 80, just remove 2 numbers from them
Now when you did that, make sure that the percentage is updated as well, using this code
Now you have the percentage of your HP. When its 800, it'll be 100%, when 0, it'll be 0%, when 400, it'll be 50%, when its 75% it'll be 75%. Enjoy
HP: 0 / 800
Make a variable called detector, and perentage, now, in the detector, use this method
- Code: Select all
detector = maxHP / 8
The value 800 was stroked down to 8, if it was 8000, it'd be 80, just remove 2 numbers from them
Now when you did that, make sure that the percentage is updated as well, using this code
- Code: Select all
percentage = detector;
Now you have the percentage of your HP. When its 800, it'll be 100%, when 0, it'll be 0%, when 400, it'll be 50%, when its 75% it'll be 75%. Enjoy