ELEC2645 (2018/19) / Mbed 2 deprecated el17ttds

Dependencies:   mbed N5110_tf

Revision:
8:d1c04f0e4890
Parent:
7:08f78909dda7
Child:
9:3a0194c87afe
diff -r 08f78909dda7 -r d1c04f0e4890 Hero/Hero.cpp
--- a/Hero/Hero.cpp	Thu May 09 01:30:57 2019 +0000
+++ b/Hero/Hero.cpp	Sat May 11 08:23:54 2019 +0000
@@ -12,20 +12,19 @@
   // _health_rate = 50; possible addition
 }
 
-bool Hero::health(bool collision, Gamepad &pad) {
+void Hero::health(bool collision, Gamepad &pad) {
   // frame_counter++;
   if (collision == true) {
     _health--;
     pad.tone(1500, 0.2);
   }
-  // if ( (frame_counter <= _health_rate) && (health < 4) ) { // increase health over time
-  if (_health <= 0) {
-    return false;
-  } else {
-    return true;
-  }
+  // if ( (frame_counter <= _health_rate) && (health < 4) ) { _health++;} // increase health over time
 }
 
 void Hero::draw(N5110 &lcd) {
-  lcd.drawCircle(_x,_y,5,FILL_TRANSPARENT);
+  lcd.drawCircle( _x, _y, 5, FILL_TRANSPARENT);
 }
+
+int Hero::get_health() {
+  return _health;
+}