Meteor defense project

Dependencies:   N5110 mbed

Revision:
28:450ab72fabdc
Parent:
27:d4926f19c12a
Child:
29:6632dd9c48d8
--- a/GameEngine/GameEngine.cpp	Fri Apr 14 21:43:05 2017 +0000
+++ b/GameEngine/GameEngine.cpp	Mon Apr 17 18:22:16 2017 +0000
@@ -23,9 +23,28 @@
     drawLaserPlayer(pad, lcd);
     bombAndShield(pad, lcd);
 }
+void GameEngine::weapUpgrade(Gamepad &pad, N5110 &lcd) {
+    if (pad.check_event(Gamepad::START_PRESSED)) { 
+        wu.upgrading = 1;
+        while (wu.upgrading == 1) {
+            wu.main_Upgrades(pad, lcd);
+            if (wu.saveTheData == 1) {
+                Data _upgrades = wu.savedata(); //saving data
+                wu.testingtest(_upgrades);  //code used to test the struct
+                printf("TESTING up = %d, up1 = %d, u1p = %d, u1p1 = %d \n",_upgrades.up,_upgrades.up1,_upgrades.u1p,_upgrades.u1p1); 
+                wu.saveTheData = 0;
+                wu.upgrading = 0; //get out of while loop after done upgrading
+            }
+            lcd.refresh();
+            wait(0.3);
+            lcd.clear();
+        } 
+        done = 1;
+        //remember to re-initialise everything after a wave.
+    }
+}
 void GameEngine::drawSpawn(N5110 &lcd){
     updateArray(); //clean up & update the array after the spawn took damage.
-    //spa.updateSpawn(Array, Array2, charArray, charArray2, lcd); //clean up on the array if the spawn dies after taking damage.
     if (drawit == 0) { //DONT FORGET TO CHANGE THIS TO TICKER. MORE EFFICIENT.
         drawit = 30;
         spa.randomizeSpawn(Array, charArray);
@@ -65,7 +84,7 @@
 void GameEngine::bombAndShield(Gamepad &pad, N5110 &lcd) { 
     weap.bombCooldown(Array2, pad, lcd);
     if (pad.check_event(Gamepad::X_PRESSED)) {
-        //to prevent from detonating the bomb at instant when button X is accidentally pressed 
+        //to prevent from detonating the bomb at instant when button X is ay1identally pressed 
     }
     if (pad.buttonhold_B == 1) { //if B pressed, generate shield. Shield doesnt have to be fully charged to be activated
         if (weap._shield > 0) { //shield will only activate if the shield has not depleted.