HealthBar Library

Revision:
1:9f2d307b3b99
Parent:
0:aa460a91bd33
Child:
3:824c16fb35e7
diff -r aa460a91bd33 -r 9f2d307b3b99 HealthBar.cpp
--- a/HealthBar.cpp	Wed May 03 15:51:20 2017 +0000
+++ b/HealthBar.cpp	Thu May 04 08:35:26 2017 +0000
@@ -31,7 +31,16 @@
 void HealthBar::draw(N5110 &lcd)
 {   //printf("%d hp \n", _HP); //working
     //printf("%d hplost1 \n", _HPLost1); //Working
-    printf("%d hplost2 \n", _HPLost2);
+    //printf("%d hplost2 \n", _HPLost2);
+    
+    
+    //Calculates Total HP by taking the initial HP value and subtracting the
+    //HP lost variables which update each time an instance resulting in 
+    //HP loss occurs.
+    //HP Bar actively updates on screen depending on remaining HP.
+    //When total hp is equal to zero, a variable is assigned the 1 value
+    //which will cause the player to lose the game.
+    
     TotalHP = _HP + _HPLost1 + _HPLost2;
     //printf("%d TotalHP \n", TotalHP);
     if(TotalHP == 8){
@@ -59,12 +68,12 @@
     lcd.drawLine(0,47,10,47,1); //Working
     }
     if(TotalHP == 0){
+        ZeroHP = 1;
     }
     
 
 }
 
-void HealthBar::update()
+void HealthBar::update() //To actively update the health bar.
 {
     }
-    
\ No newline at end of file