Labyrinth of the Minotaur A simple roguelike/RPG using a nokia 5110 screen

Dependencies:   N5110 PowerControl mbed

Revision:
33:4fc26476b2e0
Parent:
32:99ca304085e6
Child:
34:e58c8322884d
--- a/Game.cpp	Sun May 10 22:25:19 2015 +0000
+++ b/Game.cpp	Mon May 11 12:19:13 2015 +0000
@@ -160,8 +160,9 @@
     wait(1.0);
 }
 
-void MainMenu()
+void Initilize()
 {
+
     score = -100;
 
     level = 0;
@@ -175,6 +176,12 @@
     //Player armour
     pa = 5; //5 to 9
 
+}
+
+void MainMenu()
+{
+    Initilize();
+
     int menu = 0;
 
     while (1) {
@@ -231,11 +238,8 @@
 
     bool bright = 1;
 
+    lcd.clear();
     while(1) {
-
-        lcd.setBrightness(bright);
-        lcd.clear();
-
         if(bright == 1) {
             lcd.printString("Backlight ON", 6, 2);
         } else {
@@ -247,9 +251,15 @@
         if (joystick.direction != Centre) {
 
             bright = !bright;
+            lcd.setBrightness(bright);
+            lcd.clear();
         }
         if (ActFlag) {
             ActFlag = 0;
+
+            bright = !bright;
+            lcd.setBrightness(bright);
+            lcd.clear();
         }
         if(StartFlag) {
 
@@ -925,7 +935,7 @@
     lcd.printString("potion inside", 0, 1);
     lcd.printString("the chest", 0, 2);
     lcd.printString("Drink (Action)", 0, 4);
-    lcd.printString("Leave (Other)", 0, 5);
+    lcd.printString("Leave (Start)", 0, 5);
     lcd.refresh();
     wait(1.0);
     Sleep();
@@ -986,7 +996,8 @@
             wait(1.0);
             Sleep();
         }
-    } else { //Leave the potion
+    }
+    if(StartFlag) { //Leave the potion
         StartFlag = 0;
         lcd.clear();
         lcd.printString("You walk away", 0, 0);
@@ -1056,9 +1067,12 @@
     while(1) {
         Sleep();
 
+        if(StartFlag) {
+            StartFlag = 0;
+            MainMenu();
+        }
         if(ActFlag) {
             ActFlag = 0;
-            MainMenu();
         }
     }
 }