Friday 14 September 2012

MDDN 243, Project 3, Health Bar

For our game we want to have a health bar to show the charges for the battery and the other appliances.  At the moment the battery and the appliances will have 10 health points and will be going down by 10 intervals.
The Appliance charges will go down by 1 point every 5 seconds.

I am thinking of something like this for the health bar












We want there to be at least 3 different colour ranges on our health bar. We want green for 60% +, yellow for 30% - 60% and red for 0% to 30%.

When coding the health bar for the battery, I drew a green line to show the full health. I tried to make it that the end X value will be reduced by 10 whenever the Battery charge goes down by 1. This didnt work as I wanted it to, so in the end what I did was that if Battery charge = 10 it will draw a green line and if Battery Charge = 9 it will draw a different like with the same starting X and Y and the same end Y but the ending X will be shorter. This was repeated for every one of the 10 different segments for the batteries health. The colour also changes slightly each time going from Green to Red.


No comments:

Post a Comment