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

Dependencies:   N5110 PowerControl mbed

Files at this revision

API Documentation at this revision

Comitter:
ThomasBGill
Date:
Fri May 08 22:45:25 2015 +0000
Parent:
28:b3a597b38b60
Child:
30:4a03611a3d99
Commit message:
Max player health changed to 20

Changed in this revision

Game.cpp Show annotated file Show diff for this revision Revisions of this file
Game.h Show annotated file Show diff for this revision Revisions of this file
WorldBuilder/WorldBuilder.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/Game.cpp	Fri May 08 22:24:44 2015 +0000
+++ b/Game.cpp	Fri May 08 22:45:25 2015 +0000
@@ -297,7 +297,7 @@
                 PlayerMove();
 
                 if (rand() % 40 == 0) {
-                    if (ph < 15) {
+                    if (ph < PH_MAX) {
                         ph++;
                     }
                 }
@@ -435,7 +435,8 @@
 
         lcd.printString("You", 0, 2);
         char buffer2[14];
-        write = sprintf(buffer2, "%d/15", ph); // print formatted data to buffer
+        int phm = PH_MAX;
+        write = sprintf(buffer2, "%d/%d", ph, phm); // print formatted data to buffer
         lcd.printString(buffer2, 54, 2);
 
         if (menu) {
@@ -603,7 +604,8 @@
     int menu = 0;
 
     char buffer[14];
-    int write = sprintf(buffer, "Health  %d/15", ph); // print formatted data to buffer
+    int phm = PH_MAX;
+    int write = sprintf(buffer, "Health  %d/%d", ph, phm); // print formatted data to buffer
 
 
     while (1) {
@@ -956,7 +958,7 @@
 
         } else { //Full heal
 
-            ph = 15;
+            ph = PH_MAX;
 
             lcd.clear();
             lcd.printString("You drink the", 0, 0);
--- a/Game.h	Fri May 08 22:24:44 2015 +0000
+++ b/Game.h	Fri May 08 22:45:25 2015 +0000
@@ -4,6 +4,8 @@
 #include "WorldBuilder.h"
 #include "Graphics.h"
 
+#define PH_MAX 20
+
 //         vcc sce rst dc  mosi clk  led
 N5110 lcd(p5, p6, p7, p8, p11, p13, p21);
 InterruptIn Act(p22);
@@ -83,7 +85,7 @@
 int pSpace;
 
 //Player Health
-int ph = 15;
+int ph = PH_MAX;
 
 //Player weapon
 int pw = 0; //0 to 4
--- a/WorldBuilder/WorldBuilder.cpp	Fri May 08 22:24:44 2015 +0000
+++ b/WorldBuilder/WorldBuilder.cpp	Fri May 08 22:45:25 2015 +0000
@@ -94,7 +94,7 @@
         }
     }
 
-    if (rand() % 3 == 0) {
+    if (rand() % 2 == 0) {
         int i = rand() % sw + sx;
         int j = rand() % sh + sy;
         map[i][j] = CHEST;