ELEC2645 (2018/19) / Mbed 2 deprecated el17aio

Dependencies:   mbed

Revision:
14:88ca5b1a111a
Parent:
13:e114d362186d
Child:
15:009ccc07bb57
--- a/RosenEngine/RosenEngine.cpp	Wed Apr 10 12:04:07 2019 +0000
+++ b/RosenEngine/RosenEngine.cpp	Wed Apr 10 18:50:17 2019 +0000
@@ -1,6 +1,6 @@
 #include "RosenEngine.h"
 
-
+DigitalIn A_button(PTB9);
 // Constructor
 RosenEngine::RosenEngine()
 {
@@ -27,28 +27,49 @@
     _xjoystick = mapped_coord.x;
     _yjoystick = mapped_coord.y;
     _d = pad.get_direction();
-   // printf("_xjoystick ,_yjoystick = %f , %f\n",_xjoystick, _yjoystick);
+    // printf("_xjoystick ,_yjoystick = %f , %f\n",_xjoystick, _yjoystick);
 }
 
-void RosenEngine::draw(N5110 &lcd)
+void RosenEngine::draw(N5110 &lcd, Gamepad &pad)
 {
-    if(_xcursor == 0){
-        _ship.set_ship(9,6);
+    if(_xcursor == 0) {
+        _ship.set_dimensions(9,6);
         _ship.draw_ship(lcd);
         _weapons.draw(lcd);
     }
-    if(_xcursor == 1){
-        _ship.set_ship(7,10);
+    if(_xcursor == 1) {
+        _ship.set_dimensions(7,10);
         _ship.draw_imperion(lcd);
-        _weapons.draw(lcd);
+
+        if((A_button) == true) {
+            pad.tone(500,0.5);
+            wait(0.5);
+            pad.tone(1000,0.3);
+            wait(0.3);
+            pad.tone(1500,0.2);
+            wait(0.2);
+            pad.tone(1700,0.15);
+            wait(0.15);
+            while((A_button) == true) {
+                _weapons.draw_i(lcd);
+                pad.tone(2000,0.1);
+                wait(0.1);
+            }
+        }
     }
 }
 
 void RosenEngine::update(Gamepad &pad)
 {
-    _ship.update_ship(_xjoystick,_yjoystick);
-    _weapons.update();
-   // _menu.update(_d);
+    if(_xcursor == 0) {
+        _ship.update_ship(_xjoystick,_yjoystick);
+        _weapons.update();
+    }
+    if(_xcursor == 1 && A_button == false) {
+        _ship.update_ship(_xjoystick,_yjoystick);
+        _weapons.update();
+    }
+    // _menu.update(_d);
 }
 void RosenEngine::get_pos()
 {
@@ -62,7 +83,7 @@
 }
 void RosenEngine::title(N5110 &lcd)
 {
-    _menu.title(lcd); 
+    _menu.title(lcd);
     _menu.update(_d);
 }
 int RosenEngine::get_ycursor()