deemo1

Dependencies:   mbed

Revision:
6:b59bc5e15cf3
Parent:
5:32dbfaf578dd
--- a/StarcraftEngine/StarcraftEngine.cpp	Thu May 14 05:21:50 2020 +0000
+++ b/StarcraftEngine/StarcraftEngine.cpp	Thu May 14 06:30:39 2020 +0000
@@ -102,6 +102,8 @@
           (Swarm_pos.y >= HEIGHT - 1) 
         )   {                 
          _Battleship.minus_life();
+         Swarm_pos.x = rand() % 64;
+         Swarm_pos.y = 2;
          pad.tone(800.0,0.1);  //  Audio feedback 
      }
      
@@ -122,6 +124,8 @@
           (Boss_pos.y >= HEIGHT - 1) 
         )   {                 
          _Battleship.minus_life();
+         Boss_pos.x = rand() % 65;
+         Boss_pos.y = 2;
          pad.tone(800.0,0.1);  //  Audio feedback 
      }
      
@@ -144,9 +148,11 @@
      if ((Acid_pos.x >= Battleship_pos.x)&&
          (Acid_pos.x <= Battleship_pos.x + 6)&&
          (Acid_pos.y + 3 >= Battleship_pos.y)&&
-         (Acid_pos.y <= Battleship_pos.y + 3))
+         (Acid_pos.y <= Battleship_pos.y + 4))
      {
          _Battleship.minus_life();
+         Acid_pos.x = Boss_pos.x + 3;
+         Acid_pos.y = Boss_pos.y + 5; 
          pad.tone(800.0,0.1);  //  Audio feedback 
      }
      
@@ -226,9 +232,15 @@
      int Battleship_life = _Battleship.get_life();
      
      // print to LCD 
-     char buffer[14];
-     sprintf(buffer,"%2d",Battleship_score);
-     lcd.printString(buffer,WIDTH/2 - 20,1);  // font is 8 wide, so leave 4 pixel gape from middle assuming two digits
+     char buffer1[14];
+     sprintf(buffer1,"%2d",Battleship_score);
+     lcd.printString("S",5,1);
+     lcd.printString(buffer1,10,1);  // font is 8 wide, so leave 4 pixel gape from middle assuming two digits
+     
+     char buffer2[14];
+    sprintf(buffer2,"%2d",Battleship_life);
+    lcd.printString("L",WIDTH - 25,1);
+    lcd.printString(buffer2,WIDTH - 20,1);
 }