A retro gaming programme, designed for use on a portable embedded system. Incorporates power saving techniques.

Dependencies:   ConfigFile N5110 PowerControl beep mbed

Revision:
64:715fb5a1e58b
Parent:
62:827cda7a2663
Child:
65:c5dad703f752
--- a/main.cpp	Wed May 06 00:18:31 2015 +0000
+++ b/main.cpp	Thu May 07 16:41:53 2015 +0000
@@ -76,7 +76,6 @@
     {'Q','Q','Q',{17,15}},
     {'R','R','R',{18,16}},
     {'S','S','S',{19,17}},
-    
     {'T','T','T',{20,18}},
     {'U','U','U',{21,19}},
     {'V','V','V',{22,20}},
@@ -375,24 +374,10 @@
     
     score = 0;
 
-    a1 = 22;
-    a2 = 24;
-    a3 = 23;
-    a4 = 25;
-    a5 = 20;
-    a6 = 26;
-    a7 = 19;
-    a8 = 21;
-
     //in this case the X values are given a
     //new random variable each time the player
     //dies, exits or starts a new game
-    randX1 = rand() % 74 + 5;
-    randX2 = rand() % 74 + 5;
-    randX3 = rand() % 74 + 5;
-    randX4 = rand() % 74 + 5;
-    randX5 = rand() % 74 + 5;
-    randX6 = rand() % 74 + 5;
+    randomise();
 
     randY1 = 0;
     randY2 = 0;
@@ -400,6 +385,7 @@
     randY4 = 0;
     randY5 = 0;
     randY6 = 0;
+    
     lcd.clear();
 }
 
@@ -455,13 +441,7 @@
         randY6=0;
 
         score = score++;//increment score by 1 after each wave of hazards
-
-        randX1 = rand() % 74 + 5;//psuedo random number
-        randX2 = rand() % 74 + 5;//between 5 and 74
-        randX3 = rand() % 74 + 5;
-        randX4 = rand() % 74 + 5;
-        randX5 = rand() % 74 + 5;
-        randX6 = rand() % 74 + 5;
+        randomise();//randomise x co-ordinates again
     }
 }
 
@@ -679,7 +659,7 @@
     a1 = a1-=2;
     a2 = a2-=2;
     a3 = a3-=2;
-    a4 = a3 + 1;
+    a4 = a3+1;
     a5 = a3-3;
     a6 = a3-3;
     a7 = a7-=2;
@@ -1127,7 +1107,7 @@
                 wait(0.5);
                 lcd.normalMode();
                 newScore();//enter initial screen if previous scores are beaten
-                //write();
+                write();
                 resetGame();//reset values
                 break;
             }
@@ -1240,7 +1220,8 @@
             }
             drawOptionsMenu();
         }
-/////////////////////sound FX menu //////////////////////////////////////
+//================sound FX menu==========================
+
         if((option ==1)&&(buttonFlagA)) {
             buttonFlagA = 0;//reset flags
             buttonFlagB = 0;