ELEC2645 (2018/19) / Mbed 2 deprecated el17aio

Dependencies:   mbed

Revision:
27:f99249e727fd
Parent:
26:a53d41adf40b
Child:
28:6319e928f0aa
--- a/RosenEngine/RosenEngine.cpp	Thu Apr 18 11:40:47 2019 +0000
+++ b/RosenEngine/RosenEngine.cpp	Thu Apr 18 13:57:41 2019 +0000
@@ -23,6 +23,10 @@
     _health.init(_shipno);
 
 }
+void RosenEngine::reset()
+{
+    _health.init(_shipno);
+}
 
 void RosenEngine::read_input(Gamepad &pad)
 {
@@ -35,7 +39,7 @@
 
 void RosenEngine::draw(N5110 &lcd, Gamepad &pad)
 {
-    _health.draw_health(lcd);
+    _health.draw_health(lcd,_shipno);
     _health.draw_shields(lcd);
     _enemy.draw_seeker(lcd);
     if(_shipno == 0) {
@@ -66,6 +70,10 @@
         _ship.update_ship(_xjoystick,_yjoystick);
         _weapons.update();
     }
+    if(_shipno == 2) {
+        _ship.update_ship(_xjoystick,_yjoystick);
+        _weapons.update();
+    }
     // _menu.update(_d);
 
     if(enemy_ship_collision() == true){
@@ -197,7 +205,7 @@
             }
         }
         if(wxcol == 1 && wycol == 1) {
-            _weapons.set_pos(ship_xpos,ship_ypos);
+            _weapons.set_pos(ship_xpos,ship_ypos); // reset missle after contact
             return true;
         }
     }
@@ -227,4 +235,7 @@
             return false;
         }
     }
+    if(_shipno == 2) {
+        return false;
+        }
 }
\ No newline at end of file