Pokitto turn based strategy game.

Dependencies:   PokittoLib

Revision:
6:2b8e70d68247
Parent:
5:ef209f39269a
Child:
7:91365e9ad8c6
--- a/wars.cpp	Sun Dec 10 04:19:20 2017 +0000
+++ b/wars.cpp	Sun Dec 10 04:47:05 2017 +0000
@@ -263,6 +263,7 @@
         def = 2;
         range = 2.1;
         if (id == ID_HEAVY) {atk+=3; def++; range-=.5; max_hp+=2;}
+        if (id == ID_SNIPER) {def--; atk--; range+=1.5; max_hp-=2;}
         hp = max_hp;
         NewTurn();
     };
@@ -466,7 +467,20 @@
 
 #define MAP_WIDTH 12
 #define MAP_HEIGHT 12
-int Map[MAP_HEIGHT][MAP_WIDTH];
+int Map[MAP_HEIGHT][MAP_WIDTH] {
+{0,8,0,5,10,8,8,1,8,8,0,8},
+{1,0,0,21,15,14,8,0,8,0,1,0},
+{0,8,0,8,10,5,8,8,0,9,8,8},
+{0,1,8,0,10,5,1,8,8,8,0,8},
+{8,0,9,0,18,7,3,3,3,4,8,1},
+{0,8,8,0,0,5,0,0,0,12,8,13},
+{0,0,1,8,8,5,8,1,8,11,0,5},
+{8,0,8,0,8,5,8,0,0,10,0,5},
+{8,8,0,8,1,21,6,30,6,15,6,22},
+{8,0,0,8,8,0,0,5,8,12,0,0},
+{0,1,8,9,0,8,1,5,8,18,3,3},
+{0,0,8,8,8,8,0,5,8,0,8,0},
+};
 
 void loadTileMap(char * filename) {
     disp.fillLCD(disp.palette[0]);
@@ -475,9 +489,11 @@
     #ifdef POK_SIM
         game.wait(20);
     #endif
+
     pokInitSD();
-    fileOpen(filename,FILE_MODE_BINARY);
+    int success = fileOpen(filename,FILE_MODE_BINARY);
     for (int i = 0; i<144; i++) {
+        if (success==FILE_MODE_FAILED) break;
         int x = i%MAP_WIDTH;
         int y = (i-x)/MAP_WIDTH;
         //fileSetPosition(i);
@@ -740,7 +756,7 @@
                 disp.clear();
                 disp.print("LOADING");
                 pokInitSD();
-                loadTileMap("file_out.war");
+                //loadTileMap("file_out.war");
                 State = MAIN;
                 break;
             case (2):   //OPTIONS