Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: N5110 PowerControl mbed
main.cpp@18:98ea2b787894, 2015-05-03 (annotated)
- Committer:
- ThomasBGill
- Date:
- Sun May 03 21:29:01 2015 +0000
- Revision:
- 18:98ea2b787894
- Parent:
- 17:8790dd599b25
- Child:
- 19:1ab2d83ebffa
Better maze algorithm started
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ThomasBGill | 0:9200b3c387ed | 1 | #include "mbed.h" |
ThomasBGill | 0:9200b3c387ed | 2 | #include "N5110.h" |
ThomasBGill | 1:0f774d41584c | 3 | #include "PowerControl/PowerControl.h" |
ThomasBGill | 1:0f774d41584c | 4 | #include "PowerControl/EthernetPowerControl.h" |
ThomasBGill | 0:9200b3c387ed | 5 | |
ThomasBGill | 0:9200b3c387ed | 6 | // vcc sce rst dc mosi clk led |
ThomasBGill | 0:9200b3c387ed | 7 | N5110 lcd (p5, p6, p7, p8, p11, p13, p21); |
ThomasBGill | 0:9200b3c387ed | 8 | InterruptIn Act (p22); |
ThomasBGill | 0:9200b3c387ed | 9 | InterruptIn Start (p23); |
ThomasBGill | 0:9200b3c387ed | 10 | InterruptIn Up (p24); |
ThomasBGill | 0:9200b3c387ed | 11 | InterruptIn Down (p25); |
ThomasBGill | 0:9200b3c387ed | 12 | InterruptIn Left (p26); |
ThomasBGill | 0:9200b3c387ed | 13 | InterruptIn Right (p27); |
ThomasBGill | 0:9200b3c387ed | 14 | AnalogIn Noise (p19); |
ThomasBGill | 0:9200b3c387ed | 15 | |
ThomasBGill | 1:0f774d41584c | 16 | #define USR_POWERDOWN (0x104) |
ThomasBGill | 1:0f774d41584c | 17 | |
ThomasBGill | 0:9200b3c387ed | 18 | #define WALL 0 |
ThomasBGill | 0:9200b3c387ed | 19 | #define FLOOR 1 |
ThomasBGill | 0:9200b3c387ed | 20 | #define ENTER 2 |
ThomasBGill | 0:9200b3c387ed | 21 | #define EXIT 3 |
ThomasBGill | 11:b86a15d26de9 | 22 | #define FLOOR_SEEN 4 |
ThomasBGill | 12:30a242706847 | 23 | #define CHEST 5 |
ThomasBGill | 12:30a242706847 | 24 | #define CHEST_OPENED 6 |
ThomasBGill | 0:9200b3c387ed | 25 | |
ThomasBGill | 0:9200b3c387ed | 26 | #define RIGHT 0 |
ThomasBGill | 0:9200b3c387ed | 27 | #define LEFT 1 |
ThomasBGill | 0:9200b3c387ed | 28 | #define UP 2 |
ThomasBGill | 0:9200b3c387ed | 29 | #define DOWN 3 |
ThomasBGill | 0:9200b3c387ed | 30 | |
ThomasBGill | 3:1a25939df22a | 31 | #define SOUTH 0 |
ThomasBGill | 3:1a25939df22a | 32 | #define EAST 1 |
ThomasBGill | 3:1a25939df22a | 33 | |
ThomasBGill | 8:ee857f0147aa | 34 | struct TILES { |
ThomasBGill | 7:cd799c701997 | 35 | char Symbol; // Symbol for this tile |
ThomasBGill | 7:cd799c701997 | 36 | bool Passable; // Can tile be walked on |
ThomasBGill | 7:cd799c701997 | 37 | }; |
ThomasBGill | 7:cd799c701997 | 38 | |
ThomasBGill | 8:ee857f0147aa | 39 | TILES TileList[] = { |
ThomasBGill | 7:cd799c701997 | 40 | { '#', false }, // 0- WALL |
ThomasBGill | 7:cd799c701997 | 41 | { '.', true}, // 1- FLOOR |
ThomasBGill | 7:cd799c701997 | 42 | { '+', true }, // 2- ENTER |
ThomasBGill | 7:cd799c701997 | 43 | { 'x', true }, // 3- EXIT |
ThomasBGill | 11:b86a15d26de9 | 44 | { '.', true}, // 4- FLOOR_SEEN |
ThomasBGill | 12:30a242706847 | 45 | { '=', true}, // 5- CHEST |
ThomasBGill | 12:30a242706847 | 46 | { '/', true}, // 6- CHEST_OPENED |
ThomasBGill | 12:30a242706847 | 47 | }; |
ThomasBGill | 12:30a242706847 | 48 | |
ThomasBGill | 12:30a242706847 | 49 | struct ITEMS { |
ThomasBGill | 13:2195ec8bc9ff | 50 | char ItemName[15]; //Item name |
ThomasBGill | 13:2195ec8bc9ff | 51 | int ItemValue; //Damage/ armour value |
ThomasBGill | 12:30a242706847 | 52 | }; |
ThomasBGill | 12:30a242706847 | 53 | |
ThomasBGill | 12:30a242706847 | 54 | ITEMS ItemList[] = { |
ThomasBGill | 13:2195ec8bc9ff | 55 | //Weapons |
ThomasBGill | 16:a26d7519830e | 56 | { "Dagger", 4}, //0 |
ThomasBGill | 13:2195ec8bc9ff | 57 | { "Axe", 5}, //1 |
ThomasBGill | 13:2195ec8bc9ff | 58 | { "Mace", 6}, //2 |
ThomasBGill | 13:2195ec8bc9ff | 59 | { "Sword", 7}, //3 |
ThomasBGill | 13:2195ec8bc9ff | 60 | { "Warhammer", 10}, //4 |
ThomasBGill | 13:2195ec8bc9ff | 61 | //Armour |
ThomasBGill | 18:98ea2b787894 | 62 | { "Cloth armour", 1}, //5 |
ThomasBGill | 13:2195ec8bc9ff | 63 | { "Leather armour", 2}, //6 |
ThomasBGill | 18:98ea2b787894 | 64 | { "Studded armour", 3}, //7 |
ThomasBGill | 18:98ea2b787894 | 65 | { "Chainmail vest", 4}, //8 |
ThomasBGill | 18:98ea2b787894 | 66 | { "Plate armour", 5}, //9 |
ThomasBGill | 7:cd799c701997 | 67 | }; |
ThomasBGill | 7:cd799c701997 | 68 | |
ThomasBGill | 13:2195ec8bc9ff | 69 | struct ENEMIES { |
ThomasBGill | 17:8790dd599b25 | 70 | char EName[9]; //Enemy name |
ThomasBGill | 13:2195ec8bc9ff | 71 | int EHealth; //Enemy health |
ThomasBGill | 13:2195ec8bc9ff | 72 | int EDamage; //Enemy damage |
ThomasBGill | 13:2195ec8bc9ff | 73 | int EArmour; //Enemy armour |
ThomasBGill | 13:2195ec8bc9ff | 74 | int EDodge; //Enemy dodge chance |
ThomasBGill | 13:2195ec8bc9ff | 75 | int EHit; //Enemy hit chance |
ThomasBGill | 16:a26d7519830e | 76 | int ESpd; //Enemy speed (use for running away during fights) |
ThomasBGill | 13:2195ec8bc9ff | 77 | }; |
ThomasBGill | 13:2195ec8bc9ff | 78 | |
ThomasBGill | 13:2195ec8bc9ff | 79 | ENEMIES EnemyList[] = { |
ThomasBGill | 17:8790dd599b25 | 80 | //Name HP Dmg Arm Dg Ht Spd |
ThomasBGill | 17:8790dd599b25 | 81 | {"Huge Rat", 5, 3, 0, 25, 70, 40}, //0- Huge Rat |
ThomasBGill | 17:8790dd599b25 | 82 | {"Goblin", 6, 3, 2, 25, 60, 30}, //1- Goblin |
ThomasBGill | 17:8790dd599b25 | 83 | {"Skeleton", 8, 5, 3, 10, 50, 10}, //2- Skeleton |
ThomasBGill | 17:8790dd599b25 | 84 | {"Wraith", 5, 4, 0, 40, 60, 50}, //3- Wraith |
ThomasBGill | 17:8790dd599b25 | 85 | {"Ogre", 10, 7, 3, 10, 35, 15}, //4- Ogre |
ThomasBGill | 17:8790dd599b25 | 86 | {"Minotaur", 15, 8, 5, 20, 45, 100}, //5- Minotaur |
ThomasBGill | 13:2195ec8bc9ff | 87 | }; |
ThomasBGill | 7:cd799c701997 | 88 | |
ThomasBGill | 0:9200b3c387ed | 89 | //Variables |
ThomasBGill | 9:3cad581b5419 | 90 | int ActFlag = 0; |
ThomasBGill | 9:3cad581b5419 | 91 | int StartFlag = 0; |
ThomasBGill | 10:59c874d006ab | 92 | int DirFlag = 0; |
ThomasBGill | 0:9200b3c387ed | 93 | |
ThomasBGill | 0:9200b3c387ed | 94 | int map[84][48]; |
ThomasBGill | 0:9200b3c387ed | 95 | |
ThomasBGill | 2:0b0311609edc | 96 | //Enterance coordinates |
ThomasBGill | 2:0b0311609edc | 97 | int enx; |
ThomasBGill | 2:0b0311609edc | 98 | int eny; |
ThomasBGill | 2:0b0311609edc | 99 | |
ThomasBGill | 2:0b0311609edc | 100 | //Exit coordinates |
ThomasBGill | 2:0b0311609edc | 101 | int exx; |
ThomasBGill | 2:0b0311609edc | 102 | int exy; |
ThomasBGill | 2:0b0311609edc | 103 | |
ThomasBGill | 1:0f774d41584c | 104 | int sx; |
ThomasBGill | 1:0f774d41584c | 105 | int sy; |
ThomasBGill | 1:0f774d41584c | 106 | int dir; |
ThomasBGill | 1:0f774d41584c | 107 | |
ThomasBGill | 10:59c874d006ab | 108 | int level; |
ThomasBGill | 10:59c874d006ab | 109 | |
ThomasBGill | 7:cd799c701997 | 110 | //Space type player is on |
ThomasBGill | 7:cd799c701997 | 111 | int pSpace; |
ThomasBGill | 7:cd799c701997 | 112 | |
ThomasBGill | 7:cd799c701997 | 113 | //Player coordinates |
ThomasBGill | 7:cd799c701997 | 114 | int px; |
ThomasBGill | 7:cd799c701997 | 115 | int py; |
ThomasBGill | 2:0b0311609edc | 116 | |
ThomasBGill | 13:2195ec8bc9ff | 117 | //Player Health |
ThomasBGill | 13:2195ec8bc9ff | 118 | int ph = 15; |
ThomasBGill | 13:2195ec8bc9ff | 119 | |
ThomasBGill | 13:2195ec8bc9ff | 120 | //Player weapon |
ThomasBGill | 13:2195ec8bc9ff | 121 | int pw = 0; //0 to 4 |
ThomasBGill | 13:2195ec8bc9ff | 122 | |
ThomasBGill | 13:2195ec8bc9ff | 123 | //Player armour |
ThomasBGill | 13:2195ec8bc9ff | 124 | int pa = 5; //5 to 9 |
ThomasBGill | 13:2195ec8bc9ff | 125 | |
ThomasBGill | 1:0f774d41584c | 126 | //Power Saving |
ThomasBGill | 1:0f774d41584c | 127 | int semihost_powerdown() |
ThomasBGill | 1:0f774d41584c | 128 | { |
ThomasBGill | 1:0f774d41584c | 129 | uint32_t arg; |
ThomasBGill | 1:0f774d41584c | 130 | return __semihost(USR_POWERDOWN, &arg); |
ThomasBGill | 1:0f774d41584c | 131 | } |
ThomasBGill | 1:0f774d41584c | 132 | |
ThomasBGill | 0:9200b3c387ed | 133 | //ISR |
ThomasBGill | 0:9200b3c387ed | 134 | void ActPressed() |
ThomasBGill | 0:9200b3c387ed | 135 | { |
ThomasBGill | 9:3cad581b5419 | 136 | ActFlag = 1; |
ThomasBGill | 0:9200b3c387ed | 137 | } |
ThomasBGill | 0:9200b3c387ed | 138 | void StartPressed() |
ThomasBGill | 0:9200b3c387ed | 139 | { |
ThomasBGill | 9:3cad581b5419 | 140 | StartFlag = 1; |
ThomasBGill | 0:9200b3c387ed | 141 | } |
ThomasBGill | 10:59c874d006ab | 142 | void DirPressed() |
ThomasBGill | 0:9200b3c387ed | 143 | { |
ThomasBGill | 13:2195ec8bc9ff | 144 | DirFlag = 1; |
ThomasBGill | 13:2195ec8bc9ff | 145 | } |
ThomasBGill | 10:59c874d006ab | 146 | |
ThomasBGill | 13:2195ec8bc9ff | 147 | //Voids |
ThomasBGill | 13:2195ec8bc9ff | 148 | void MainMenu(); |
ThomasBGill | 15:05a227f970c2 | 149 | void GameLoop(); |
ThomasBGill | 0:9200b3c387ed | 150 | |
ThomasBGill | 0:9200b3c387ed | 151 | void Walls() |
ThomasBGill | 0:9200b3c387ed | 152 | { |
ThomasBGill | 0:9200b3c387ed | 153 | //Fill map with walls |
ThomasBGill | 0:9200b3c387ed | 154 | for(int i=0; i<84; i++) { |
ThomasBGill | 0:9200b3c387ed | 155 | for (int j=0; j<48; j++) { |
ThomasBGill | 3:1a25939df22a | 156 | |
ThomasBGill | 0:9200b3c387ed | 157 | map[i][j] = WALL; |
ThomasBGill | 0:9200b3c387ed | 158 | } |
ThomasBGill | 0:9200b3c387ed | 159 | } |
ThomasBGill | 0:9200b3c387ed | 160 | } |
ThomasBGill | 0:9200b3c387ed | 161 | |
ThomasBGill | 3:1a25939df22a | 162 | void Floors() |
ThomasBGill | 3:1a25939df22a | 163 | { |
ThomasBGill | 3:1a25939df22a | 164 | //Fill map with floors |
ThomasBGill | 3:1a25939df22a | 165 | for(int i=0; i<84; i++) { |
ThomasBGill | 3:1a25939df22a | 166 | for (int j=0; j<48; j++) { |
ThomasBGill | 3:1a25939df22a | 167 | map[i][j] = FLOOR; |
ThomasBGill | 3:1a25939df22a | 168 | } |
ThomasBGill | 3:1a25939df22a | 169 | } |
ThomasBGill | 3:1a25939df22a | 170 | } |
ThomasBGill | 3:1a25939df22a | 171 | |
ThomasBGill | 9:3cad581b5419 | 172 | void FlashPlayerLocation() |
ThomasBGill | 9:3cad581b5419 | 173 | { |
ThomasBGill | 9:3cad581b5419 | 174 | lcd.setPixel(px,py); |
ThomasBGill | 9:3cad581b5419 | 175 | lcd.refresh(); |
ThomasBGill | 9:3cad581b5419 | 176 | wait(0.5); |
ThomasBGill | 9:3cad581b5419 | 177 | lcd.clearPixel(px,py); |
ThomasBGill | 9:3cad581b5419 | 178 | lcd.refresh(); |
ThomasBGill | 9:3cad581b5419 | 179 | wait(0.5); |
ThomasBGill | 13:2195ec8bc9ff | 180 | } |
ThomasBGill | 9:3cad581b5419 | 181 | |
ThomasBGill | 9:3cad581b5419 | 182 | |
ThomasBGill | 1:0f774d41584c | 183 | void DrawMap() |
ThomasBGill | 1:0f774d41584c | 184 | { |
ThomasBGill | 1:0f774d41584c | 185 | //Draw map on screen |
ThomasBGill | 1:0f774d41584c | 186 | for(int i=0; i<84; i++) { |
ThomasBGill | 1:0f774d41584c | 187 | for (int j=0; j<48; j++) { |
ThomasBGill | 12:30a242706847 | 188 | if(map[i][j] == FLOOR_SEEN || map[i][j] == CHEST_OPENED) { |
ThomasBGill | 1:0f774d41584c | 189 | lcd.clearPixel(i, j); |
ThomasBGill | 1:0f774d41584c | 190 | } else { |
ThomasBGill | 1:0f774d41584c | 191 | lcd.setPixel(i, j); |
ThomasBGill | 1:0f774d41584c | 192 | } |
ThomasBGill | 1:0f774d41584c | 193 | } |
ThomasBGill | 1:0f774d41584c | 194 | } |
ThomasBGill | 1:0f774d41584c | 195 | lcd.refresh(); |
ThomasBGill | 1:0f774d41584c | 196 | } |
ThomasBGill | 1:0f774d41584c | 197 | |
ThomasBGill | 0:9200b3c387ed | 198 | void FirstRoom() |
ThomasBGill | 0:9200b3c387ed | 199 | { |
ThomasBGill | 0:9200b3c387ed | 200 | //Create initial room |
ThomasBGill | 1:0f774d41584c | 201 | int si = rand()%25 + 1; |
ThomasBGill | 1:0f774d41584c | 202 | int sj = rand()%15 + 1; |
ThomasBGill | 0:9200b3c387ed | 203 | |
ThomasBGill | 0:9200b3c387ed | 204 | int sw = rand()%5+5; |
ThomasBGill | 0:9200b3c387ed | 205 | int sh = rand()%5+5; |
ThomasBGill | 0:9200b3c387ed | 206 | |
ThomasBGill | 0:9200b3c387ed | 207 | for(int i = si, w = si + sw; i <w; i++) { |
ThomasBGill | 0:9200b3c387ed | 208 | for (int j = sj, h = sj + sh; j <h; j++) { |
ThomasBGill | 0:9200b3c387ed | 209 | map[i][j] = FLOOR; |
ThomasBGill | 0:9200b3c387ed | 210 | } |
ThomasBGill | 0:9200b3c387ed | 211 | } |
ThomasBGill | 0:9200b3c387ed | 212 | //Create enterance in room |
ThomasBGill | 2:0b0311609edc | 213 | enx = rand()%sw + si; |
ThomasBGill | 2:0b0311609edc | 214 | eny = rand()%sh + sj; |
ThomasBGill | 2:0b0311609edc | 215 | map[enx][eny] = ENTER; |
ThomasBGill | 2:0b0311609edc | 216 | } |
ThomasBGill | 2:0b0311609edc | 217 | |
ThomasBGill | 5:9bd276652111 | 218 | void ExitRoom() |
ThomasBGill | 5:9bd276652111 | 219 | { |
ThomasBGill | 6:ca5db4353c95 | 220 | //Create exit room |
ThomasBGill | 5:9bd276652111 | 221 | int si = rand()%50 + 30; |
ThomasBGill | 5:9bd276652111 | 222 | int sj = rand()%25 + 20; |
ThomasBGill | 5:9bd276652111 | 223 | |
ThomasBGill | 5:9bd276652111 | 224 | int sw = rand()%5+5; |
ThomasBGill | 5:9bd276652111 | 225 | int sh = rand()%5+5; |
ThomasBGill | 5:9bd276652111 | 226 | |
ThomasBGill | 5:9bd276652111 | 227 | for(int i = si, w = si + sw; i <w; i++) { |
ThomasBGill | 5:9bd276652111 | 228 | for (int j = sj, h = sj + sh; j <h; j++) { |
ThomasBGill | 5:9bd276652111 | 229 | map[i][j] = FLOOR; |
ThomasBGill | 5:9bd276652111 | 230 | } |
ThomasBGill | 5:9bd276652111 | 231 | } |
ThomasBGill | 6:ca5db4353c95 | 232 | //Create exit in room |
ThomasBGill | 8:ee857f0147aa | 233 | exx = rand()%sw + si; |
ThomasBGill | 8:ee857f0147aa | 234 | exy = rand()%sh + sj; |
ThomasBGill | 8:ee857f0147aa | 235 | map[exx][exy] = EXIT; |
ThomasBGill | 13:2195ec8bc9ff | 236 | |
ThomasBGill | 5:9bd276652111 | 237 | } |
ThomasBGill | 5:9bd276652111 | 238 | |
ThomasBGill | 2:0b0311609edc | 239 | void DungeonRoomBuilder() |
ThomasBGill | 2:0b0311609edc | 240 | { |
ThomasBGill | 2:0b0311609edc | 241 | sx = rand()%84; |
ThomasBGill | 2:0b0311609edc | 242 | sy = rand()%48; |
ThomasBGill | 2:0b0311609edc | 243 | |
ThomasBGill | 2:0b0311609edc | 244 | //Get length |
ThomasBGill | 2:0b0311609edc | 245 | int sw = rand()%5 + 5; |
ThomasBGill | 2:0b0311609edc | 246 | int sh = rand()%5 + 5; |
ThomasBGill | 2:0b0311609edc | 247 | |
ThomasBGill | 2:0b0311609edc | 248 | int b = 0; |
ThomasBGill | 2:0b0311609edc | 249 | |
ThomasBGill | 2:0b0311609edc | 250 | //Check each space. +1 to variable if wall. If total = w*h then build room |
ThomasBGill | 2:0b0311609edc | 251 | for(int i = sx; i < sx + sw; i++) { |
ThomasBGill | 2:0b0311609edc | 252 | for(int j = sy; j < sy + sh; j++) { |
ThomasBGill | 2:0b0311609edc | 253 | if(map[i][j] == WALL) { |
ThomasBGill | 2:0b0311609edc | 254 | b++; |
ThomasBGill | 2:0b0311609edc | 255 | } |
ThomasBGill | 2:0b0311609edc | 256 | } |
ThomasBGill | 2:0b0311609edc | 257 | } |
ThomasBGill | 2:0b0311609edc | 258 | if(b == sw*sh) { |
ThomasBGill | 2:0b0311609edc | 259 | for(int i = sx; i < sx + sw; i++) { |
ThomasBGill | 2:0b0311609edc | 260 | for(int j = sy; j < sy + sh; j++) { |
ThomasBGill | 2:0b0311609edc | 261 | if(i < 84 && j < 48) { |
ThomasBGill | 1:0f774d41584c | 262 | map[i][j] = FLOOR; |
ThomasBGill | 1:0f774d41584c | 263 | } |
ThomasBGill | 1:0f774d41584c | 264 | } |
ThomasBGill | 1:0f774d41584c | 265 | } |
ThomasBGill | 1:0f774d41584c | 266 | } |
ThomasBGill | 17:8790dd599b25 | 267 | if(rand()%3 == 0) { |
ThomasBGill | 12:30a242706847 | 268 | int i = rand()%sw + sx; |
ThomasBGill | 12:30a242706847 | 269 | int j = rand()%sh + sy; |
ThomasBGill | 12:30a242706847 | 270 | map[i][j] = CHEST; |
ThomasBGill | 12:30a242706847 | 271 | } |
ThomasBGill | 1:0f774d41584c | 272 | } |
ThomasBGill | 1:0f774d41584c | 273 | |
ThomasBGill | 13:2195ec8bc9ff | 274 | int Neighbours(int i, int j) |
ThomasBGill | 4:6482ceb08dc8 | 275 | { |
ThomasBGill | 4:6482ceb08dc8 | 276 | //Check neighbours |
ThomasBGill | 13:2195ec8bc9ff | 277 | int n = 0; |
ThomasBGill | 4:6482ceb08dc8 | 278 | |
ThomasBGill | 13:2195ec8bc9ff | 279 | if(map[i+1][j] == FLOOR) { |
ThomasBGill | 4:6482ceb08dc8 | 280 | n++; |
ThomasBGill | 4:6482ceb08dc8 | 281 | } |
ThomasBGill | 13:2195ec8bc9ff | 282 | if(map[i-1][j] == FLOOR) { |
ThomasBGill | 13:2195ec8bc9ff | 283 | n++; |
ThomasBGill | 13:2195ec8bc9ff | 284 | } |
ThomasBGill | 13:2195ec8bc9ff | 285 | if(map[i][j+1] == FLOOR) { |
ThomasBGill | 4:6482ceb08dc8 | 286 | n++; |
ThomasBGill | 4:6482ceb08dc8 | 287 | } |
ThomasBGill | 13:2195ec8bc9ff | 288 | if(map[i][j-1] == FLOOR) { |
ThomasBGill | 4:6482ceb08dc8 | 289 | n++; |
ThomasBGill | 4:6482ceb08dc8 | 290 | } |
ThomasBGill | 13:2195ec8bc9ff | 291 | |
ThomasBGill | 13:2195ec8bc9ff | 292 | return n; |
ThomasBGill | 4:6482ceb08dc8 | 293 | } |
ThomasBGill | 4:6482ceb08dc8 | 294 | |
ThomasBGill | 10:59c874d006ab | 295 | void DeadEnds(int d) |
ThomasBGill | 4:6482ceb08dc8 | 296 | { |
ThomasBGill | 10:59c874d006ab | 297 | for (int del = d; del > 0; del--) { |
ThomasBGill | 4:6482ceb08dc8 | 298 | for(int i = 0; i < 84; i++) { |
ThomasBGill | 4:6482ceb08dc8 | 299 | for(int j = 0; j < 48; j++) { |
ThomasBGill | 4:6482ceb08dc8 | 300 | |
ThomasBGill | 13:2195ec8bc9ff | 301 | if(Neighbours(i , j) < 2) { |
ThomasBGill | 4:6482ceb08dc8 | 302 | map[i][j] = WALL; |
ThomasBGill | 4:6482ceb08dc8 | 303 | } |
ThomasBGill | 4:6482ceb08dc8 | 304 | } |
ThomasBGill | 4:6482ceb08dc8 | 305 | } |
ThomasBGill | 4:6482ceb08dc8 | 306 | } |
ThomasBGill | 4:6482ceb08dc8 | 307 | } |
ThomasBGill | 4:6482ceb08dc8 | 308 | |
ThomasBGill | 5:9bd276652111 | 309 | void Border() |
ThomasBGill | 5:9bd276652111 | 310 | { |
ThomasBGill | 5:9bd276652111 | 311 | |
ThomasBGill | 5:9bd276652111 | 312 | for(int i = 0; i < 84; i++) { |
ThomasBGill | 5:9bd276652111 | 313 | for(int j = 0; j < 48; j++) { |
ThomasBGill | 5:9bd276652111 | 314 | |
ThomasBGill | 5:9bd276652111 | 315 | if(i == 0 || i == 83 || j == 0 || j == 47) { |
ThomasBGill | 5:9bd276652111 | 316 | |
ThomasBGill | 5:9bd276652111 | 317 | map[i][j] = WALL; |
ThomasBGill | 5:9bd276652111 | 318 | |
ThomasBGill | 5:9bd276652111 | 319 | } |
ThomasBGill | 5:9bd276652111 | 320 | } |
ThomasBGill | 5:9bd276652111 | 321 | } |
ThomasBGill | 5:9bd276652111 | 322 | } |
ThomasBGill | 4:6482ceb08dc8 | 323 | |
ThomasBGill | 9:3cad581b5419 | 324 | void RandFloor(int r) |
ThomasBGill | 9:3cad581b5419 | 325 | { |
ThomasBGill | 9:3cad581b5419 | 326 | |
ThomasBGill | 9:3cad581b5419 | 327 | for(int space = rand()%50 + r; space > 0; space--) { |
ThomasBGill | 9:3cad581b5419 | 328 | |
ThomasBGill | 9:3cad581b5419 | 329 | int i = rand()% 84; |
ThomasBGill | 9:3cad581b5419 | 330 | int j = rand()% 48; |
ThomasBGill | 9:3cad581b5419 | 331 | |
ThomasBGill | 9:3cad581b5419 | 332 | if(rand()%2 == 0 && map[i][j] == WALL) { |
ThomasBGill | 9:3cad581b5419 | 333 | map[i][j] = FLOOR; |
ThomasBGill | 9:3cad581b5419 | 334 | } |
ThomasBGill | 9:3cad581b5419 | 335 | } |
ThomasBGill | 9:3cad581b5419 | 336 | |
ThomasBGill | 9:3cad581b5419 | 337 | } |
ThomasBGill | 9:3cad581b5419 | 338 | |
ThomasBGill | 2:0b0311609edc | 339 | void Maze() |
ThomasBGill | 2:0b0311609edc | 340 | { |
ThomasBGill | 18:98ea2b787894 | 341 | for(int i = 1; i < 83; i+=2) { |
ThomasBGill | 18:98ea2b787894 | 342 | for(int j = 1; j < 47; j+=2) { |
ThomasBGill | 2:0b0311609edc | 343 | |
ThomasBGill | 5:9bd276652111 | 344 | if(map[i][j] == WALL) { |
ThomasBGill | 5:9bd276652111 | 345 | map[i][j] = FLOOR; |
ThomasBGill | 5:9bd276652111 | 346 | } |
ThomasBGill | 2:0b0311609edc | 347 | |
ThomasBGill | 3:1a25939df22a | 348 | dir = rand()%2; //South or east |
ThomasBGill | 2:0b0311609edc | 349 | |
ThomasBGill | 4:6482ceb08dc8 | 350 | |
ThomasBGill | 5:9bd276652111 | 351 | if(dir == SOUTH && j < 47 && map[i][j+1] == WALL) { |
ThomasBGill | 3:1a25939df22a | 352 | map[i][j+1] = FLOOR; |
ThomasBGill | 2:0b0311609edc | 353 | } |
ThomasBGill | 5:9bd276652111 | 354 | if(dir == EAST && i < 84 && map[i+1][j] == WALL) { |
ThomasBGill | 3:1a25939df22a | 355 | map[i+1][j] = FLOOR; |
ThomasBGill | 2:0b0311609edc | 356 | } |
ThomasBGill | 2:0b0311609edc | 357 | } |
ThomasBGill | 2:0b0311609edc | 358 | } |
ThomasBGill | 2:0b0311609edc | 359 | } |
ThomasBGill | 2:0b0311609edc | 360 | |
ThomasBGill | 18:98ea2b787894 | 361 | void MazeNew() |
ThomasBGill | 18:98ea2b787894 | 362 | { |
ThomasBGill | 18:98ea2b787894 | 363 | sx = 1; |
ThomasBGill | 18:98ea2b787894 | 364 | sy = 1; |
ThomasBGill | 18:98ea2b787894 | 365 | |
ThomasBGill | 18:98ea2b787894 | 366 | //Choose random direction |
ThomasBGill | 18:98ea2b787894 | 367 | //Check if 2 cells in direction have no neighbours (excluding current position) |
ThomasBGill | 18:98ea2b787894 | 368 | //If true then build and set new current position |
ThomasBGill | 18:98ea2b787894 | 369 | //If false chose next direction |
ThomasBGill | 18:98ea2b787894 | 370 | |
ThomasBGill | 18:98ea2b787894 | 371 | //If cannot move in any direction scan through each cell until there is one which can be built on |
ThomasBGill | 18:98ea2b787894 | 372 | //If scan completes END |
ThomasBGill | 18:98ea2b787894 | 373 | |
ThomasBGill | 18:98ea2b787894 | 374 | int move[4] = {UP, DOWN, LEFT, RIGHT}; |
ThomasBGill | 18:98ea2b787894 | 375 | |
ThomasBGill | 18:98ea2b787894 | 376 | for(int s = 0; s < 3; s++){ //Shuffle array |
ThomasBGill | 18:98ea2b787894 | 377 | |
ThomasBGill | 18:98ea2b787894 | 378 | int r = rand()%4; |
ThomasBGill | 18:98ea2b787894 | 379 | |
ThomasBGill | 18:98ea2b787894 | 380 | int temp = move[s]; |
ThomasBGill | 18:98ea2b787894 | 381 | |
ThomasBGill | 18:98ea2b787894 | 382 | move[s] = move[r]; |
ThomasBGill | 18:98ea2b787894 | 383 | |
ThomasBGill | 18:98ea2b787894 | 384 | move[r] = temp; |
ThomasBGill | 18:98ea2b787894 | 385 | } |
ThomasBGill | 18:98ea2b787894 | 386 | |
ThomasBGill | 18:98ea2b787894 | 387 | |
ThomasBGill | 18:98ea2b787894 | 388 | } |
ThomasBGill | 18:98ea2b787894 | 389 | |
ThomasBGill | 2:0b0311609edc | 390 | void DungeonBuilder() |
ThomasBGill | 0:9200b3c387ed | 391 | { |
ThomasBGill | 1:0f774d41584c | 392 | |
ThomasBGill | 4:6482ceb08dc8 | 393 | FirstRoom(); |
ThomasBGill | 5:9bd276652111 | 394 | ExitRoom(); |
ThomasBGill | 4:6482ceb08dc8 | 395 | |
ThomasBGill | 18:98ea2b787894 | 396 | int rn = rand()%10 + 6; |
ThomasBGill | 2:0b0311609edc | 397 | |
ThomasBGill | 2:0b0311609edc | 398 | for(int i = rn; i>0; i--) { |
ThomasBGill | 2:0b0311609edc | 399 | DungeonRoomBuilder(); |
ThomasBGill | 2:0b0311609edc | 400 | } |
ThomasBGill | 2:0b0311609edc | 401 | |
ThomasBGill | 9:3cad581b5419 | 402 | Maze(); |
ThomasBGill | 5:9bd276652111 | 403 | |
ThomasBGill | 9:3cad581b5419 | 404 | RandFloor(51); |
ThomasBGill | 9:3cad581b5419 | 405 | |
ThomasBGill | 9:3cad581b5419 | 406 | Border(); |
ThomasBGill | 9:3cad581b5419 | 407 | |
ThomasBGill | 10:59c874d006ab | 408 | DeadEnds(20); |
ThomasBGill | 9:3cad581b5419 | 409 | |
ThomasBGill | 9:3cad581b5419 | 410 | } |
ThomasBGill | 9:3cad581b5419 | 411 | |
ThomasBGill | 9:3cad581b5419 | 412 | void LabyrinthBuilder() |
ThomasBGill | 9:3cad581b5419 | 413 | { |
ThomasBGill | 9:3cad581b5419 | 414 | |
ThomasBGill | 9:3cad581b5419 | 415 | FirstRoom(); |
ThomasBGill | 9:3cad581b5419 | 416 | ExitRoom(); |
ThomasBGill | 4:6482ceb08dc8 | 417 | |
ThomasBGill | 3:1a25939df22a | 418 | Maze(); |
ThomasBGill | 3:1a25939df22a | 419 | |
ThomasBGill | 9:3cad581b5419 | 420 | RandFloor(551); |
ThomasBGill | 9:3cad581b5419 | 421 | |
ThomasBGill | 9:3cad581b5419 | 422 | Border(); |
ThomasBGill | 9:3cad581b5419 | 423 | |
ThomasBGill | 2:0b0311609edc | 424 | } |
ThomasBGill | 2:0b0311609edc | 425 | |
ThomasBGill | 2:0b0311609edc | 426 | void World() |
ThomasBGill | 2:0b0311609edc | 427 | { |
ThomasBGill | 2:0b0311609edc | 428 | Walls(); |
ThomasBGill | 12:30a242706847 | 429 | if(level == 5) { |
ThomasBGill | 12:30a242706847 | 430 | LabyrinthBuilder(); |
ThomasBGill | 12:30a242706847 | 431 | } else { |
ThomasBGill | 12:30a242706847 | 432 | DungeonBuilder(); |
ThomasBGill | 12:30a242706847 | 433 | } |
ThomasBGill | 6:ca5db4353c95 | 434 | |
ThomasBGill | 8:ee857f0147aa | 435 | px = enx; |
ThomasBGill | 8:ee857f0147aa | 436 | py = eny; |
ThomasBGill | 8:ee857f0147aa | 437 | |
ThomasBGill | 8:ee857f0147aa | 438 | wait(1.0); |
ThomasBGill | 0:9200b3c387ed | 439 | } |
ThomasBGill | 0:9200b3c387ed | 440 | |
ThomasBGill | 8:ee857f0147aa | 441 | void PlayerCamera() |
ThomasBGill | 8:ee857f0147aa | 442 | { |
ThomasBGill | 8:ee857f0147aa | 443 | lcd.clear(); |
ThomasBGill | 8:ee857f0147aa | 444 | |
ThomasBGill | 8:ee857f0147aa | 445 | int tile; |
ThomasBGill | 8:ee857f0147aa | 446 | |
ThomasBGill | 8:ee857f0147aa | 447 | for(int i = 0; i < 14; i++) { |
ThomasBGill | 8:ee857f0147aa | 448 | for(int j = 0; j < 6; j++) { |
ThomasBGill | 8:ee857f0147aa | 449 | |
ThomasBGill | 8:ee857f0147aa | 450 | if(i == 6 && j == 2) { |
ThomasBGill | 8:ee857f0147aa | 451 | lcd.printString("@", (6*i)+1, j); |
ThomasBGill | 8:ee857f0147aa | 452 | } else { |
ThomasBGill | 8:ee857f0147aa | 453 | int diffx = i - 6; |
ThomasBGill | 8:ee857f0147aa | 454 | int diffy = j - 2; |
ThomasBGill | 8:ee857f0147aa | 455 | |
ThomasBGill | 9:3cad581b5419 | 456 | if(px+diffx < 84 && px+diffx > 0 && py+diffy < 48 && py+diffy > 0) { |
ThomasBGill | 9:3cad581b5419 | 457 | tile = map[px+diffx][py+diffy]; |
ThomasBGill | 9:3cad581b5419 | 458 | } else { |
ThomasBGill | 9:3cad581b5419 | 459 | tile = WALL; |
ThomasBGill | 9:3cad581b5419 | 460 | } |
ThomasBGill | 8:ee857f0147aa | 461 | lcd.printChar(TileList[tile].Symbol, (6*i)+1, j); |
ThomasBGill | 11:b86a15d26de9 | 462 | |
ThomasBGill | 11:b86a15d26de9 | 463 | if(map[px+diffx][py+diffy] == FLOOR) { |
ThomasBGill | 11:b86a15d26de9 | 464 | map[px+diffx][py+diffy] = FLOOR_SEEN; |
ThomasBGill | 11:b86a15d26de9 | 465 | } |
ThomasBGill | 11:b86a15d26de9 | 466 | |
ThomasBGill | 8:ee857f0147aa | 467 | } |
ThomasBGill | 8:ee857f0147aa | 468 | } |
ThomasBGill | 8:ee857f0147aa | 469 | } |
ThomasBGill | 8:ee857f0147aa | 470 | lcd.refresh(); |
ThomasBGill | 8:ee857f0147aa | 471 | } |
ThomasBGill | 8:ee857f0147aa | 472 | |
ThomasBGill | 8:ee857f0147aa | 473 | void PlayerMove() |
ThomasBGill | 8:ee857f0147aa | 474 | { |
ThomasBGill | 8:ee857f0147aa | 475 | if(Up) { |
ThomasBGill | 8:ee857f0147aa | 476 | int tile = map[px][py-1]; |
ThomasBGill | 8:ee857f0147aa | 477 | if(TileList[tile].Passable) { |
ThomasBGill | 8:ee857f0147aa | 478 | py--; |
ThomasBGill | 8:ee857f0147aa | 479 | } |
ThomasBGill | 8:ee857f0147aa | 480 | } |
ThomasBGill | 8:ee857f0147aa | 481 | if(Down) { |
ThomasBGill | 8:ee857f0147aa | 482 | int tile = map[px][py+1]; |
ThomasBGill | 8:ee857f0147aa | 483 | if(TileList[tile].Passable) { |
ThomasBGill | 8:ee857f0147aa | 484 | py++; |
ThomasBGill | 8:ee857f0147aa | 485 | } |
ThomasBGill | 8:ee857f0147aa | 486 | } |
ThomasBGill | 8:ee857f0147aa | 487 | if(Right) { |
ThomasBGill | 8:ee857f0147aa | 488 | int tile = map[px+1][py]; |
ThomasBGill | 8:ee857f0147aa | 489 | if(TileList[tile].Passable) { |
ThomasBGill | 8:ee857f0147aa | 490 | px++; |
ThomasBGill | 8:ee857f0147aa | 491 | } |
ThomasBGill | 8:ee857f0147aa | 492 | } |
ThomasBGill | 8:ee857f0147aa | 493 | if(Left) { |
ThomasBGill | 8:ee857f0147aa | 494 | int tile = map[px-1][py]; |
ThomasBGill | 8:ee857f0147aa | 495 | if(TileList[tile].Passable) { |
ThomasBGill | 8:ee857f0147aa | 496 | px--; |
ThomasBGill | 8:ee857f0147aa | 497 | } |
ThomasBGill | 8:ee857f0147aa | 498 | } |
ThomasBGill | 13:2195ec8bc9ff | 499 | } |
ThomasBGill | 13:2195ec8bc9ff | 500 | |
ThomasBGill | 15:05a227f970c2 | 501 | void GameOver() |
ThomasBGill | 15:05a227f970c2 | 502 | { |
ThomasBGill | 16:a26d7519830e | 503 | lcd.inverseMode(); |
ThomasBGill | 15:05a227f970c2 | 504 | lcd.clear(); |
ThomasBGill | 15:05a227f970c2 | 505 | lcd.printString("GAME OVER", 12, 2); |
ThomasBGill | 15:05a227f970c2 | 506 | lcd.refresh(); |
ThomasBGill | 15:05a227f970c2 | 507 | wait(1.0); |
ThomasBGill | 15:05a227f970c2 | 508 | Sleep(); |
ThomasBGill | 16:a26d7519830e | 509 | lcd.normalMode(); |
ThomasBGill | 15:05a227f970c2 | 510 | MainMenu(); |
ThomasBGill | 15:05a227f970c2 | 511 | } |
ThomasBGill | 15:05a227f970c2 | 512 | |
ThomasBGill | 16:a26d7519830e | 513 | void MonsterAttack(int m) |
ThomasBGill | 16:a26d7519830e | 514 | { |
ThomasBGill | 16:a26d7519830e | 515 | if(rand()%100 + 1 < EnemyList[m].EHit) { //If monster hits and isn't dead |
ThomasBGill | 16:a26d7519830e | 516 | |
ThomasBGill | 16:a26d7519830e | 517 | int damage = EnemyList[m].EDamage - ItemList[pa].ItemValue + rand()%3 - rand()%3; //Calculate damage |
ThomasBGill | 16:a26d7519830e | 518 | if (damage < 0) { |
ThomasBGill | 16:a26d7519830e | 519 | damage = 0; |
ThomasBGill | 16:a26d7519830e | 520 | } |
ThomasBGill | 16:a26d7519830e | 521 | ph = ph - damage; //Apply damage and calculate the monster's health |
ThomasBGill | 16:a26d7519830e | 522 | |
ThomasBGill | 16:a26d7519830e | 523 | char buffer[14]; |
ThomasBGill | 16:a26d7519830e | 524 | int write = sprintf(buffer,"%d damage",damage); // print formatted data to buffer |
ThomasBGill | 16:a26d7519830e | 525 | |
ThomasBGill | 16:a26d7519830e | 526 | lcd.clear(); |
ThomasBGill | 16:a26d7519830e | 527 | lcd.printString(EnemyList[m].EName, 0 ,1); |
ThomasBGill | 16:a26d7519830e | 528 | lcd.printString("hits you for", 0 , 2); |
ThomasBGill | 16:a26d7519830e | 529 | lcd.printString(buffer, 0 , 3); |
ThomasBGill | 16:a26d7519830e | 530 | lcd.refresh(); |
ThomasBGill | 16:a26d7519830e | 531 | wait(1.0); |
ThomasBGill | 16:a26d7519830e | 532 | Sleep(); |
ThomasBGill | 16:a26d7519830e | 533 | |
ThomasBGill | 16:a26d7519830e | 534 | } else { //You dodge |
ThomasBGill | 16:a26d7519830e | 535 | lcd.clear(); |
ThomasBGill | 16:a26d7519830e | 536 | lcd.printString("You dodge the", 0 ,1); |
ThomasBGill | 16:a26d7519830e | 537 | lcd.printString("monster's", 0 , 2); |
ThomasBGill | 16:a26d7519830e | 538 | lcd.printString("attack", 0 , 3); |
ThomasBGill | 16:a26d7519830e | 539 | lcd.refresh(); |
ThomasBGill | 16:a26d7519830e | 540 | wait(1.0); |
ThomasBGill | 16:a26d7519830e | 541 | Sleep(); |
ThomasBGill | 16:a26d7519830e | 542 | } |
ThomasBGill | 16:a26d7519830e | 543 | if(ph <= 0) { //Check if player is dead |
ThomasBGill | 16:a26d7519830e | 544 | GameOver(); |
ThomasBGill | 16:a26d7519830e | 545 | } |
ThomasBGill | 16:a26d7519830e | 546 | |
ThomasBGill | 16:a26d7519830e | 547 | } |
ThomasBGill | 16:a26d7519830e | 548 | |
ThomasBGill | 13:2195ec8bc9ff | 549 | void Fight() |
ThomasBGill | 13:2195ec8bc9ff | 550 | { |
ThomasBGill | 18:98ea2b787894 | 551 | int m = rand()%(level+1); |
ThomasBGill | 13:2195ec8bc9ff | 552 | |
ThomasBGill | 13:2195ec8bc9ff | 553 | int mh = EnemyList[m].EHealth; |
ThomasBGill | 13:2195ec8bc9ff | 554 | |
ThomasBGill | 13:2195ec8bc9ff | 555 | lcd.clear(); |
ThomasBGill | 13:2195ec8bc9ff | 556 | lcd.printString("FIGHT!", 24, 2); |
ThomasBGill | 13:2195ec8bc9ff | 557 | |
ThomasBGill | 13:2195ec8bc9ff | 558 | for(int i = 0; i<5; i++) { |
ThomasBGill | 13:2195ec8bc9ff | 559 | lcd.inverseMode(); |
ThomasBGill | 13:2195ec8bc9ff | 560 | lcd.refresh(); |
ThomasBGill | 13:2195ec8bc9ff | 561 | wait(0.2); |
ThomasBGill | 13:2195ec8bc9ff | 562 | lcd.normalMode(); |
ThomasBGill | 13:2195ec8bc9ff | 563 | lcd.refresh(); |
ThomasBGill | 13:2195ec8bc9ff | 564 | wait(0.2); |
ThomasBGill | 13:2195ec8bc9ff | 565 | } |
ThomasBGill | 13:2195ec8bc9ff | 566 | |
ThomasBGill | 13:2195ec8bc9ff | 567 | bool menu = 1; |
ThomasBGill | 13:2195ec8bc9ff | 568 | |
ThomasBGill | 13:2195ec8bc9ff | 569 | while(1) { |
ThomasBGill | 13:2195ec8bc9ff | 570 | ActFlag = 0; |
ThomasBGill | 13:2195ec8bc9ff | 571 | StartFlag = 0; |
ThomasBGill | 13:2195ec8bc9ff | 572 | DirFlag = 0; |
ThomasBGill | 13:2195ec8bc9ff | 573 | |
ThomasBGill | 13:2195ec8bc9ff | 574 | lcd.clear(); |
ThomasBGill | 13:2195ec8bc9ff | 575 | |
ThomasBGill | 13:2195ec8bc9ff | 576 | lcd.printString(EnemyList[m].EName, 0, 0); |
ThomasBGill | 13:2195ec8bc9ff | 577 | char buffer1[14]; |
ThomasBGill | 13:2195ec8bc9ff | 578 | int write = sprintf(buffer1,"%d/%d",mh, EnemyList[m].EHealth); // print formatted data to buffer |
ThomasBGill | 13:2195ec8bc9ff | 579 | lcd.printString(buffer1, 54, 0); |
ThomasBGill | 13:2195ec8bc9ff | 580 | |
ThomasBGill | 13:2195ec8bc9ff | 581 | lcd.printString("You", 0, 2); |
ThomasBGill | 13:2195ec8bc9ff | 582 | char buffer2[14]; |
ThomasBGill | 13:2195ec8bc9ff | 583 | write = sprintf(buffer2,"%d/15",ph); // print formatted data to buffer |
ThomasBGill | 13:2195ec8bc9ff | 584 | lcd.printString(buffer2, 54, 2); |
ThomasBGill | 13:2195ec8bc9ff | 585 | |
ThomasBGill | 13:2195ec8bc9ff | 586 | if(menu) { |
ThomasBGill | 13:2195ec8bc9ff | 587 | lcd.printString("Fight <", 0, 4); |
ThomasBGill | 13:2195ec8bc9ff | 588 | lcd.printString("Run", 0, 5); |
ThomasBGill | 13:2195ec8bc9ff | 589 | } else { |
ThomasBGill | 13:2195ec8bc9ff | 590 | lcd.printString("Fight", 0, 4); |
ThomasBGill | 13:2195ec8bc9ff | 591 | lcd.printString("Run <", 0, 5); |
ThomasBGill | 13:2195ec8bc9ff | 592 | } |
ThomasBGill | 13:2195ec8bc9ff | 593 | lcd.refresh(); |
ThomasBGill | 13:2195ec8bc9ff | 594 | Sleep(); |
ThomasBGill | 13:2195ec8bc9ff | 595 | |
ThomasBGill | 13:2195ec8bc9ff | 596 | if(DirFlag) { |
ThomasBGill | 13:2195ec8bc9ff | 597 | DirFlag = 0; |
ThomasBGill | 13:2195ec8bc9ff | 598 | menu = !menu; |
ThomasBGill | 13:2195ec8bc9ff | 599 | } |
ThomasBGill | 13:2195ec8bc9ff | 600 | if(ActFlag) { |
ThomasBGill | 13:2195ec8bc9ff | 601 | ActFlag = 0; |
ThomasBGill | 13:2195ec8bc9ff | 602 | if(menu) { //Fight |
ThomasBGill | 13:2195ec8bc9ff | 603 | //Hit monster |
ThomasBGill | 13:2195ec8bc9ff | 604 | if(rand()%100 + 1 > EnemyList[m].EDodge) { //If monster doesn't dodge |
ThomasBGill | 13:2195ec8bc9ff | 605 | |
ThomasBGill | 13:2195ec8bc9ff | 606 | int damage = ItemList[pw].ItemValue - EnemyList[m].EArmour + rand()%3 - rand()%3; //Calculate damage |
ThomasBGill | 15:05a227f970c2 | 607 | if (damage < 0) { |
ThomasBGill | 15:05a227f970c2 | 608 | damage = 0; |
ThomasBGill | 13:2195ec8bc9ff | 609 | } |
ThomasBGill | 15:05a227f970c2 | 610 | mh = mh - damage; //Apply damage and calculate the monster's health |
ThomasBGill | 15:05a227f970c2 | 611 | |
ThomasBGill | 15:05a227f970c2 | 612 | char buffer3[14]; |
ThomasBGill | 15:05a227f970c2 | 613 | write = sprintf(buffer3,"for %d damage",damage); // print formatted data to buffer |
ThomasBGill | 15:05a227f970c2 | 614 | |
ThomasBGill | 15:05a227f970c2 | 615 | lcd.clear(); |
ThomasBGill | 16:a26d7519830e | 616 | lcd.printString("You hit the", 0 , 1); |
ThomasBGill | 16:a26d7519830e | 617 | lcd.printString(EnemyList[m].EName, 0 ,2); |
ThomasBGill | 16:a26d7519830e | 618 | lcd.printString(buffer3, 0, 3); |
ThomasBGill | 15:05a227f970c2 | 619 | lcd.refresh(); |
ThomasBGill | 15:05a227f970c2 | 620 | wait(1.0); |
ThomasBGill | 15:05a227f970c2 | 621 | Sleep(); |
ThomasBGill | 15:05a227f970c2 | 622 | |
ThomasBGill | 15:05a227f970c2 | 623 | } else { //Monster dodges |
ThomasBGill | 15:05a227f970c2 | 624 | lcd.clear(); |
ThomasBGill | 16:a26d7519830e | 625 | lcd.printString(EnemyList[m].EName, 0 ,1); |
ThomasBGill | 16:a26d7519830e | 626 | lcd.printString("dodges your", 0 , 2); |
ThomasBGill | 16:a26d7519830e | 627 | lcd.printString("attack", 0 , 3); |
ThomasBGill | 15:05a227f970c2 | 628 | lcd.refresh(); |
ThomasBGill | 15:05a227f970c2 | 629 | wait(1.0); |
ThomasBGill | 15:05a227f970c2 | 630 | Sleep(); |
ThomasBGill | 13:2195ec8bc9ff | 631 | } |
ThomasBGill | 13:2195ec8bc9ff | 632 | |
ThomasBGill | 16:a26d7519830e | 633 | if(mh <= 0) { //Check if monster is dead |
ThomasBGill | 13:2195ec8bc9ff | 634 | lcd.clear(); |
ThomasBGill | 15:05a227f970c2 | 635 | lcd.printString("You win!", 18, 2); |
ThomasBGill | 13:2195ec8bc9ff | 636 | lcd.refresh(); |
ThomasBGill | 15:05a227f970c2 | 637 | wait(1.0); |
ThomasBGill | 13:2195ec8bc9ff | 638 | Sleep(); |
ThomasBGill | 13:2195ec8bc9ff | 639 | break; |
ThomasBGill | 13:2195ec8bc9ff | 640 | } |
ThomasBGill | 13:2195ec8bc9ff | 641 | |
ThomasBGill | 16:a26d7519830e | 642 | MonsterAttack(m); |
ThomasBGill | 16:a26d7519830e | 643 | |
ThomasBGill | 13:2195ec8bc9ff | 644 | |
ThomasBGill | 16:a26d7519830e | 645 | } else { //Run away |
ThomasBGill | 15:05a227f970c2 | 646 | |
ThomasBGill | 16:a26d7519830e | 647 | int b = rand()%5; |
ThomasBGill | 16:a26d7519830e | 648 | |
ThomasBGill | 16:a26d7519830e | 649 | if(b == 0) { //Monster blocks the path |
ThomasBGill | 15:05a227f970c2 | 650 | |
ThomasBGill | 15:05a227f970c2 | 651 | lcd.clear(); |
ThomasBGill | 16:a26d7519830e | 652 | lcd.printString("You try to run", 0, 0); |
ThomasBGill | 16:a26d7519830e | 653 | lcd.printString("away but the", 0, 1); |
ThomasBGill | 16:a26d7519830e | 654 | lcd.printString("monster blocks", 0, 2); |
ThomasBGill | 16:a26d7519830e | 655 | lcd.printString("the path", 0, 3); |
ThomasBGill | 15:05a227f970c2 | 656 | lcd.refresh(); |
ThomasBGill | 15:05a227f970c2 | 657 | wait(1.0); |
ThomasBGill | 15:05a227f970c2 | 658 | Sleep(); |
ThomasBGill | 15:05a227f970c2 | 659 | |
ThomasBGill | 16:a26d7519830e | 660 | MonsterAttack(m); |
ThomasBGill | 16:a26d7519830e | 661 | |
ThomasBGill | 16:a26d7519830e | 662 | } else { |
ThomasBGill | 16:a26d7519830e | 663 | |
ThomasBGill | 16:a26d7519830e | 664 | int s = rand()%100 + 1; |
ThomasBGill | 16:a26d7519830e | 665 | |
ThomasBGill | 16:a26d7519830e | 666 | if(s > EnemyList[m].ESpd) { //If you outspeed monster |
ThomasBGill | 16:a26d7519830e | 667 | |
ThomasBGill | 16:a26d7519830e | 668 | lcd.clear(); |
ThomasBGill | 16:a26d7519830e | 669 | lcd.printString("You run away", 6, 2); |
ThomasBGill | 16:a26d7519830e | 670 | lcd.refresh(); |
ThomasBGill | 17:8790dd599b25 | 671 | wait(1.0); |
ThomasBGill | 16:a26d7519830e | 672 | Sleep(); |
ThomasBGill | 16:a26d7519830e | 673 | break; |
ThomasBGill | 16:a26d7519830e | 674 | |
ThomasBGill | 16:a26d7519830e | 675 | } else { |
ThomasBGill | 16:a26d7519830e | 676 | |
ThomasBGill | 16:a26d7519830e | 677 | lcd.clear(); |
ThomasBGill | 16:a26d7519830e | 678 | lcd.printString("You try to run", 0, 0); |
ThomasBGill | 16:a26d7519830e | 679 | lcd.printString("away but the", 0, 1); |
ThomasBGill | 16:a26d7519830e | 680 | lcd.printString("monster", 0, 2); |
ThomasBGill | 16:a26d7519830e | 681 | lcd.printString("catches up to", 0, 3); |
ThomasBGill | 16:a26d7519830e | 682 | lcd.printString("you", 0, 4); |
ThomasBGill | 16:a26d7519830e | 683 | lcd.refresh(); |
ThomasBGill | 16:a26d7519830e | 684 | wait(1.0); |
ThomasBGill | 16:a26d7519830e | 685 | Sleep(); |
ThomasBGill | 16:a26d7519830e | 686 | |
ThomasBGill | 16:a26d7519830e | 687 | MonsterAttack(m); |
ThomasBGill | 16:a26d7519830e | 688 | |
ThomasBGill | 16:a26d7519830e | 689 | } |
ThomasBGill | 8:ee857f0147aa | 690 | |
ThomasBGill | 9:3cad581b5419 | 691 | |
ThomasBGill | 16:a26d7519830e | 692 | } |
ThomasBGill | 13:2195ec8bc9ff | 693 | } |
ThomasBGill | 13:2195ec8bc9ff | 694 | } |
ThomasBGill | 13:2195ec8bc9ff | 695 | } |
ThomasBGill | 13:2195ec8bc9ff | 696 | } |
ThomasBGill | 13:2195ec8bc9ff | 697 | |
ThomasBGill | 13:2195ec8bc9ff | 698 | void Map() |
ThomasBGill | 13:2195ec8bc9ff | 699 | { |
ThomasBGill | 13:2195ec8bc9ff | 700 | lcd.clear(); |
ThomasBGill | 13:2195ec8bc9ff | 701 | DrawMap(); |
ThomasBGill | 13:2195ec8bc9ff | 702 | while(!StartFlag) { |
ThomasBGill | 13:2195ec8bc9ff | 703 | FlashPlayerLocation(); |
ThomasBGill | 13:2195ec8bc9ff | 704 | } |
ThomasBGill | 13:2195ec8bc9ff | 705 | StartFlag = 0; |
ThomasBGill | 14:55802ce40285 | 706 | ActFlag = 0; |
ThomasBGill | 14:55802ce40285 | 707 | DirFlag = 0; |
ThomasBGill | 13:2195ec8bc9ff | 708 | } |
ThomasBGill | 13:2195ec8bc9ff | 709 | |
ThomasBGill | 13:2195ec8bc9ff | 710 | |
ThomasBGill | 13:2195ec8bc9ff | 711 | void Inventory() |
ThomasBGill | 13:2195ec8bc9ff | 712 | { |
ThomasBGill | 13:2195ec8bc9ff | 713 | lcd.clear(); |
ThomasBGill | 13:2195ec8bc9ff | 714 | lcd.printString("Armour:", 0, 0); |
ThomasBGill | 13:2195ec8bc9ff | 715 | lcd.printString(ItemList[pa].ItemName, 0, 1); |
ThomasBGill | 13:2195ec8bc9ff | 716 | char buffer1[14]; |
ThomasBGill | 13:2195ec8bc9ff | 717 | int write = sprintf(buffer1,"+%d Armour", ItemList[pa].ItemValue); // print formatted data to buffer |
ThomasBGill | 13:2195ec8bc9ff | 718 | lcd.printString(buffer1, 0, 2); |
ThomasBGill | 13:2195ec8bc9ff | 719 | |
ThomasBGill | 13:2195ec8bc9ff | 720 | lcd.printString("Weapon:", 0, 3); |
ThomasBGill | 13:2195ec8bc9ff | 721 | lcd.printString(ItemList[pw].ItemName, 0, 4); |
ThomasBGill | 13:2195ec8bc9ff | 722 | char buffer2[14]; |
ThomasBGill | 13:2195ec8bc9ff | 723 | write = sprintf(buffer2,"+%d Damage", ItemList[pw].ItemValue); // print formatted data to buffer |
ThomasBGill | 13:2195ec8bc9ff | 724 | lcd.printString(buffer2, 0, 5); |
ThomasBGill | 13:2195ec8bc9ff | 725 | lcd.refresh(); |
ThomasBGill | 14:55802ce40285 | 726 | |
ThomasBGill | 14:55802ce40285 | 727 | while(1) { |
ThomasBGill | 14:55802ce40285 | 728 | Sleep(); |
ThomasBGill | 14:55802ce40285 | 729 | |
ThomasBGill | 14:55802ce40285 | 730 | if(ActFlag) { |
ThomasBGill | 14:55802ce40285 | 731 | ActFlag = 0; |
ThomasBGill | 14:55802ce40285 | 732 | } |
ThomasBGill | 14:55802ce40285 | 733 | if(DirFlag) { |
ThomasBGill | 14:55802ce40285 | 734 | DirFlag = 0; |
ThomasBGill | 14:55802ce40285 | 735 | break; |
ThomasBGill | 14:55802ce40285 | 736 | } |
ThomasBGill | 14:55802ce40285 | 737 | if(StartFlag) { |
ThomasBGill | 14:55802ce40285 | 738 | StartFlag = 0; |
ThomasBGill | 14:55802ce40285 | 739 | break; |
ThomasBGill | 14:55802ce40285 | 740 | } |
ThomasBGill | 14:55802ce40285 | 741 | } |
ThomasBGill | 14:55802ce40285 | 742 | } |
ThomasBGill | 14:55802ce40285 | 743 | |
ThomasBGill | 14:55802ce40285 | 744 | void MapLegend() |
ThomasBGill | 14:55802ce40285 | 745 | { |
ThomasBGill | 14:55802ce40285 | 746 | lcd.clear(); |
ThomasBGill | 14:55802ce40285 | 747 | lcd.printString("@ Player", 0 ,0); |
ThomasBGill | 14:55802ce40285 | 748 | lcd.printString("# Wall", 0, 1); |
ThomasBGill | 14:55802ce40285 | 749 | lcd.printString(". Floor", 0, 2); |
ThomasBGill | 14:55802ce40285 | 750 | lcd.printString("= Chest", 0, 3); |
ThomasBGill | 14:55802ce40285 | 751 | lcd.printString("/ Open Chest", 0, 4); |
ThomasBGill | 15:05a227f970c2 | 752 | |
ThomasBGill | 14:55802ce40285 | 753 | |
ThomasBGill | 14:55802ce40285 | 754 | while(1) { |
ThomasBGill | 14:55802ce40285 | 755 | Sleep(); |
ThomasBGill | 14:55802ce40285 | 756 | |
ThomasBGill | 14:55802ce40285 | 757 | if(ActFlag) { |
ThomasBGill | 14:55802ce40285 | 758 | ActFlag = 0; |
ThomasBGill | 14:55802ce40285 | 759 | } |
ThomasBGill | 14:55802ce40285 | 760 | if(DirFlag) { |
ThomasBGill | 14:55802ce40285 | 761 | DirFlag = 0; |
ThomasBGill | 14:55802ce40285 | 762 | break; |
ThomasBGill | 14:55802ce40285 | 763 | } |
ThomasBGill | 14:55802ce40285 | 764 | if(StartFlag) { |
ThomasBGill | 14:55802ce40285 | 765 | StartFlag = 0; |
ThomasBGill | 14:55802ce40285 | 766 | break; |
ThomasBGill | 14:55802ce40285 | 767 | } |
ThomasBGill | 14:55802ce40285 | 768 | } |
ThomasBGill | 8:ee857f0147aa | 769 | } |
ThomasBGill | 8:ee857f0147aa | 770 | |
ThomasBGill | 9:3cad581b5419 | 771 | void StartMenu() |
ThomasBGill | 9:3cad581b5419 | 772 | { |
ThomasBGill | 13:2195ec8bc9ff | 773 | int menu = 0; |
ThomasBGill | 9:3cad581b5419 | 774 | |
ThomasBGill | 14:55802ce40285 | 775 | char buffer[14]; |
ThomasBGill | 14:55802ce40285 | 776 | int write = sprintf(buffer,"Health %d/15",ph); // print formatted data to buffer |
ThomasBGill | 14:55802ce40285 | 777 | |
ThomasBGill | 14:55802ce40285 | 778 | |
ThomasBGill | 13:2195ec8bc9ff | 779 | while(1) { |
ThomasBGill | 13:2195ec8bc9ff | 780 | if(menu == 0) { |
ThomasBGill | 13:2195ec8bc9ff | 781 | lcd.clear(); |
ThomasBGill | 14:55802ce40285 | 782 | lcd.printString(buffer, 0, 0); |
ThomasBGill | 14:55802ce40285 | 783 | lcd.printString("Map <", 0, 2); |
ThomasBGill | 14:55802ce40285 | 784 | lcd.printString("Map Legend", 0, 3); |
ThomasBGill | 14:55802ce40285 | 785 | lcd.printString("Inventory", 0, 4); |
ThomasBGill | 14:55802ce40285 | 786 | lcd.printString("Continue", 0, 5); |
ThomasBGill | 13:2195ec8bc9ff | 787 | lcd.refresh(); |
ThomasBGill | 13:2195ec8bc9ff | 788 | Sleep(); |
ThomasBGill | 13:2195ec8bc9ff | 789 | } else if (menu == 1) { |
ThomasBGill | 13:2195ec8bc9ff | 790 | lcd.clear(); |
ThomasBGill | 14:55802ce40285 | 791 | lcd.printString(buffer, 0, 0); |
ThomasBGill | 14:55802ce40285 | 792 | lcd.printString("Map", 0, 2); |
ThomasBGill | 14:55802ce40285 | 793 | lcd.printString("Map Legend <", 0, 3); |
ThomasBGill | 14:55802ce40285 | 794 | lcd.printString("Inventory", 0, 4); |
ThomasBGill | 14:55802ce40285 | 795 | lcd.printString("Continue", 0, 5); |
ThomasBGill | 13:2195ec8bc9ff | 796 | lcd.refresh(); |
ThomasBGill | 13:2195ec8bc9ff | 797 | Sleep(); |
ThomasBGill | 13:2195ec8bc9ff | 798 | } else if (menu == 2) { |
ThomasBGill | 13:2195ec8bc9ff | 799 | lcd.clear(); |
ThomasBGill | 14:55802ce40285 | 800 | lcd.printString(buffer, 0, 0); |
ThomasBGill | 14:55802ce40285 | 801 | lcd.printString("Map", 0, 2); |
ThomasBGill | 14:55802ce40285 | 802 | lcd.printString("Map Legend", 0, 3); |
ThomasBGill | 14:55802ce40285 | 803 | lcd.printString("Inventory <", 0, 4); |
ThomasBGill | 14:55802ce40285 | 804 | lcd.printString("Continue", 0, 5); |
ThomasBGill | 14:55802ce40285 | 805 | lcd.refresh(); |
ThomasBGill | 14:55802ce40285 | 806 | Sleep(); |
ThomasBGill | 15:05a227f970c2 | 807 | } else if (menu == 3) { |
ThomasBGill | 14:55802ce40285 | 808 | lcd.clear(); |
ThomasBGill | 14:55802ce40285 | 809 | lcd.printString(buffer, 0, 0); |
ThomasBGill | 14:55802ce40285 | 810 | lcd.printString("Map", 0, 2); |
ThomasBGill | 14:55802ce40285 | 811 | lcd.printString("Map Legend", 0, 3); |
ThomasBGill | 14:55802ce40285 | 812 | lcd.printString("Inventory", 0, 4); |
ThomasBGill | 14:55802ce40285 | 813 | lcd.printString("Continue <", 0, 5); |
ThomasBGill | 13:2195ec8bc9ff | 814 | lcd.refresh(); |
ThomasBGill | 13:2195ec8bc9ff | 815 | Sleep(); |
ThomasBGill | 9:3cad581b5419 | 816 | } |
ThomasBGill | 13:2195ec8bc9ff | 817 | |
ThomasBGill | 13:2195ec8bc9ff | 818 | if(DirFlag) { |
ThomasBGill | 13:2195ec8bc9ff | 819 | DirFlag = 0; |
ThomasBGill | 14:55802ce40285 | 820 | if((Down || Right) && menu < 3) { |
ThomasBGill | 13:2195ec8bc9ff | 821 | menu++; |
ThomasBGill | 13:2195ec8bc9ff | 822 | } else if((Up ||Left) && menu > 0) |
ThomasBGill | 13:2195ec8bc9ff | 823 | menu--; |
ThomasBGill | 13:2195ec8bc9ff | 824 | } |
ThomasBGill | 13:2195ec8bc9ff | 825 | if(ActFlag) { |
ThomasBGill | 13:2195ec8bc9ff | 826 | ActFlag = 0; |
ThomasBGill | 13:2195ec8bc9ff | 827 | if(menu == 0) { |
ThomasBGill | 13:2195ec8bc9ff | 828 | Map(); |
ThomasBGill | 13:2195ec8bc9ff | 829 | } else if(menu == 1) { |
ThomasBGill | 14:55802ce40285 | 830 | MapLegend(); |
ThomasBGill | 14:55802ce40285 | 831 | } else if(menu == 2) { |
ThomasBGill | 13:2195ec8bc9ff | 832 | Inventory(); |
ThomasBGill | 13:2195ec8bc9ff | 833 | } else { |
ThomasBGill | 13:2195ec8bc9ff | 834 | break; |
ThomasBGill | 13:2195ec8bc9ff | 835 | } |
ThomasBGill | 13:2195ec8bc9ff | 836 | } |
ThomasBGill | 16:a26d7519830e | 837 | if(StartFlag) { |
ThomasBGill | 16:a26d7519830e | 838 | StartFlag = 0; |
ThomasBGill | 16:a26d7519830e | 839 | } |
ThomasBGill | 9:3cad581b5419 | 840 | } |
ThomasBGill | 10:59c874d006ab | 841 | } |
ThomasBGill | 9:3cad581b5419 | 842 | |
ThomasBGill | 13:2195ec8bc9ff | 843 | |
ThomasBGill | 10:59c874d006ab | 844 | void Intro() |
ThomasBGill | 10:59c874d006ab | 845 | { |
ThomasBGill | 10:59c874d006ab | 846 | lcd.clear(); |
ThomasBGill | 10:59c874d006ab | 847 | lcd.printString("TBG RPG", 20, 2); |
ThomasBGill | 10:59c874d006ab | 848 | lcd.refresh(); |
ThomasBGill | 10:59c874d006ab | 849 | wait(1.0); |
ThomasBGill | 10:59c874d006ab | 850 | } |
ThomasBGill | 10:59c874d006ab | 851 | |
ThomasBGill | 10:59c874d006ab | 852 | void LevelScreen() |
ThomasBGill | 10:59c874d006ab | 853 | { |
ThomasBGill | 12:30a242706847 | 854 | char buffer[14]; |
ThomasBGill | 12:30a242706847 | 855 | |
ThomasBGill | 12:30a242706847 | 856 | int write = sprintf(buffer,"Level %d",level); // print formatted data to buffer |
ThomasBGill | 11:b86a15d26de9 | 857 | |
ThomasBGill | 10:59c874d006ab | 858 | lcd.clear(); |
ThomasBGill | 10:59c874d006ab | 859 | lcd.printString(buffer, 20, 2); |
ThomasBGill | 10:59c874d006ab | 860 | lcd.refresh(); |
ThomasBGill | 10:59c874d006ab | 861 | wait(1.0); |
ThomasBGill | 10:59c874d006ab | 862 | |
ThomasBGill | 10:59c874d006ab | 863 | } |
ThomasBGill | 10:59c874d006ab | 864 | |
ThomasBGill | 15:05a227f970c2 | 865 | void getItem() |
ThomasBGill | 12:30a242706847 | 866 | { |
ThomasBGill | 15:05a227f970c2 | 867 | |
ThomasBGill | 13:2195ec8bc9ff | 868 | int r = rand()%10; |
ThomasBGill | 12:30a242706847 | 869 | |
ThomasBGill | 12:30a242706847 | 870 | DirFlag = 0; |
ThomasBGill | 12:30a242706847 | 871 | |
ThomasBGill | 15:05a227f970c2 | 872 | lcd.clear(); |
ThomasBGill | 15:05a227f970c2 | 873 | lcd.printString("Do you want to", 0, 1); |
ThomasBGill | 15:05a227f970c2 | 874 | lcd.printString("take the", 0, 2); |
ThomasBGill | 15:05a227f970c2 | 875 | lcd.printString(ItemList[r].ItemName, 0, 3); |
ThomasBGill | 15:05a227f970c2 | 876 | lcd.printString("-Yes (Action)", 0, 4); |
ThomasBGill | 15:05a227f970c2 | 877 | lcd.printString("-No (Other)", 0, 5); |
ThomasBGill | 15:05a227f970c2 | 878 | lcd.refresh(); |
ThomasBGill | 16:a26d7519830e | 879 | wait(1.0); |
ThomasBGill | 15:05a227f970c2 | 880 | Sleep(); |
ThomasBGill | 15:05a227f970c2 | 881 | |
ThomasBGill | 15:05a227f970c2 | 882 | |
ThomasBGill | 15:05a227f970c2 | 883 | if(ActFlag) { |
ThomasBGill | 15:05a227f970c2 | 884 | |
ThomasBGill | 15:05a227f970c2 | 885 | ActFlag = 0; |
ThomasBGill | 15:05a227f970c2 | 886 | |
ThomasBGill | 15:05a227f970c2 | 887 | if (r > 5) { |
ThomasBGill | 15:05a227f970c2 | 888 | pa = r; |
ThomasBGill | 15:05a227f970c2 | 889 | } else { |
ThomasBGill | 15:05a227f970c2 | 890 | pw = r; |
ThomasBGill | 15:05a227f970c2 | 891 | } |
ThomasBGill | 15:05a227f970c2 | 892 | |
ThomasBGill | 15:05a227f970c2 | 893 | lcd.clear(); |
ThomasBGill | 15:05a227f970c2 | 894 | lcd.printString("You take the", 0, 1); |
ThomasBGill | 15:05a227f970c2 | 895 | lcd.printString(ItemList[r].ItemName, 0, 2); |
ThomasBGill | 15:05a227f970c2 | 896 | lcd.refresh(); |
ThomasBGill | 16:a26d7519830e | 897 | wait(1.0); |
ThomasBGill | 16:a26d7519830e | 898 | Sleep(); |
ThomasBGill | 15:05a227f970c2 | 899 | |
ThomasBGill | 16:a26d7519830e | 900 | } else { |
ThomasBGill | 16:a26d7519830e | 901 | |
ThomasBGill | 16:a26d7519830e | 902 | StartFlag = 0; |
ThomasBGill | 15:05a227f970c2 | 903 | DirFlag = 0; |
ThomasBGill | 15:05a227f970c2 | 904 | |
ThomasBGill | 13:2195ec8bc9ff | 905 | lcd.clear(); |
ThomasBGill | 15:05a227f970c2 | 906 | lcd.printString("You leave the", 0, 1); |
ThomasBGill | 15:05a227f970c2 | 907 | lcd.printString(ItemList[r].ItemName, 0, 2); |
ThomasBGill | 15:05a227f970c2 | 908 | lcd.refresh(); |
ThomasBGill | 16:a26d7519830e | 909 | wait(1.0); |
ThomasBGill | 16:a26d7519830e | 910 | Sleep(); |
ThomasBGill | 15:05a227f970c2 | 911 | } |
ThomasBGill | 15:05a227f970c2 | 912 | } |
ThomasBGill | 15:05a227f970c2 | 913 | |
ThomasBGill | 15:05a227f970c2 | 914 | void BoobyTrap() |
ThomasBGill | 15:05a227f970c2 | 915 | { |
ThomasBGill | 15:05a227f970c2 | 916 | |
ThomasBGill | 15:05a227f970c2 | 917 | int damage = rand()%5; |
ThomasBGill | 15:05a227f970c2 | 918 | |
ThomasBGill | 15:05a227f970c2 | 919 | if(damage != 0) { |
ThomasBGill | 15:05a227f970c2 | 920 | |
ThomasBGill | 15:05a227f970c2 | 921 | ph = ph - damage; |
ThomasBGill | 15:05a227f970c2 | 922 | |
ThomasBGill | 15:05a227f970c2 | 923 | char buffer[15]; |
ThomasBGill | 15:05a227f970c2 | 924 | int write = sprintf(buffer, "You recive %d", damage); |
ThomasBGill | 15:05a227f970c2 | 925 | |
ThomasBGill | 15:05a227f970c2 | 926 | lcd.clear(); |
ThomasBGill | 15:05a227f970c2 | 927 | lcd.printString("The chest is", 0, 0); |
ThomasBGill | 16:a26d7519830e | 928 | lcd.printString("booby trapped!", 0, 1); |
ThomasBGill | 15:05a227f970c2 | 929 | lcd.printString(buffer, 0, 3); |
ThomasBGill | 15:05a227f970c2 | 930 | lcd.printString("damage", 0, 4); |
ThomasBGill | 15:05a227f970c2 | 931 | lcd.refresh(); |
ThomasBGill | 15:05a227f970c2 | 932 | wait(1.0); |
ThomasBGill | 13:2195ec8bc9ff | 933 | Sleep(); |
ThomasBGill | 12:30a242706847 | 934 | |
ThomasBGill | 15:05a227f970c2 | 935 | //Check if player is dead |
ThomasBGill | 15:05a227f970c2 | 936 | if(ph < 0) { |
ThomasBGill | 15:05a227f970c2 | 937 | GameOver(); |
ThomasBGill | 15:05a227f970c2 | 938 | } |
ThomasBGill | 15:05a227f970c2 | 939 | } else { |
ThomasBGill | 12:30a242706847 | 940 | |
ThomasBGill | 15:05a227f970c2 | 941 | lcd.clear(); |
ThomasBGill | 15:05a227f970c2 | 942 | lcd.printString("The chest is", 0, 0); |
ThomasBGill | 16:a26d7519830e | 943 | lcd.printString("booby trapped", 0, 1); |
ThomasBGill | 16:a26d7519830e | 944 | lcd.printString("but the trap", 0, 2); |
ThomasBGill | 16:a26d7519830e | 945 | lcd.printString("fails", 0, 3); |
ThomasBGill | 15:05a227f970c2 | 946 | lcd.refresh(); |
ThomasBGill | 15:05a227f970c2 | 947 | wait(1.0); |
ThomasBGill | 15:05a227f970c2 | 948 | Sleep(); |
ThomasBGill | 15:05a227f970c2 | 949 | |
ThomasBGill | 15:05a227f970c2 | 950 | } |
ThomasBGill | 15:05a227f970c2 | 951 | } |
ThomasBGill | 13:2195ec8bc9ff | 952 | |
ThomasBGill | 15:05a227f970c2 | 953 | void RevealMap() |
ThomasBGill | 15:05a227f970c2 | 954 | { |
ThomasBGill | 15:05a227f970c2 | 955 | |
ThomasBGill | 15:05a227f970c2 | 956 | for(int i = 0; i < 84; i++) { |
ThomasBGill | 15:05a227f970c2 | 957 | for(int j = 0; j < 48; j++) { |
ThomasBGill | 15:05a227f970c2 | 958 | |
ThomasBGill | 15:05a227f970c2 | 959 | if(map[i][j] == FLOOR) { |
ThomasBGill | 15:05a227f970c2 | 960 | map[i][j] = FLOOR_SEEN; |
ThomasBGill | 15:05a227f970c2 | 961 | } |
ThomasBGill | 15:05a227f970c2 | 962 | } |
ThomasBGill | 15:05a227f970c2 | 963 | } |
ThomasBGill | 12:30a242706847 | 964 | |
ThomasBGill | 15:05a227f970c2 | 965 | lcd.clear(); |
ThomasBGill | 15:05a227f970c2 | 966 | lcd.printString("You find a map", 0, 0); |
ThomasBGill | 16:a26d7519830e | 967 | lcd.printString("of the current", 0, 1); |
ThomasBGill | 16:a26d7519830e | 968 | lcd.printString("level inside", 0, 2); |
ThomasBGill | 16:a26d7519830e | 969 | lcd.printString("the chest", 0, 3); |
ThomasBGill | 15:05a227f970c2 | 970 | lcd.refresh(); |
ThomasBGill | 15:05a227f970c2 | 971 | wait(1.0); |
ThomasBGill | 15:05a227f970c2 | 972 | Sleep(); |
ThomasBGill | 15:05a227f970c2 | 973 | } |
ThomasBGill | 15:05a227f970c2 | 974 | |
ThomasBGill | 15:05a227f970c2 | 975 | void Potion() |
ThomasBGill | 15:05a227f970c2 | 976 | { |
ThomasBGill | 15:05a227f970c2 | 977 | |
ThomasBGill | 15:05a227f970c2 | 978 | int p = rand()%5; //0- Poison, 1- Teleport, Else- Full heal |
ThomasBGill | 15:05a227f970c2 | 979 | |
ThomasBGill | 15:05a227f970c2 | 980 | lcd.clear(); |
ThomasBGill | 15:05a227f970c2 | 981 | lcd.printString("You find a", 0, 0); |
ThomasBGill | 16:a26d7519830e | 982 | lcd.printString("potion inside", 0, 1); |
ThomasBGill | 16:a26d7519830e | 983 | lcd.printString("the chest", 0, 2); |
ThomasBGill | 15:05a227f970c2 | 984 | lcd.printString("Drink (Action)", 0, 4); |
ThomasBGill | 15:05a227f970c2 | 985 | lcd.printString("Leave (Other)", 0, 5); |
ThomasBGill | 15:05a227f970c2 | 986 | lcd.refresh(); |
ThomasBGill | 15:05a227f970c2 | 987 | wait(1.0); |
ThomasBGill | 15:05a227f970c2 | 988 | Sleep(); |
ThomasBGill | 15:05a227f970c2 | 989 | |
ThomasBGill | 15:05a227f970c2 | 990 | if(ActFlag) { //Potion drunk |
ThomasBGill | 15:05a227f970c2 | 991 | ActFlag = 0; |
ThomasBGill | 15:05a227f970c2 | 992 | |
ThomasBGill | 15:05a227f970c2 | 993 | if(p == 0) { //Poison |
ThomasBGill | 15:05a227f970c2 | 994 | |
ThomasBGill | 15:05a227f970c2 | 995 | int damage = rand()%4 + 1; |
ThomasBGill | 15:05a227f970c2 | 996 | |
ThomasBGill | 15:05a227f970c2 | 997 | ph = ph - damage; |
ThomasBGill | 15:05a227f970c2 | 998 | |
ThomasBGill | 15:05a227f970c2 | 999 | char buffer[15]; |
ThomasBGill | 15:05a227f970c2 | 1000 | int write = sprintf(buffer, "%d damage", damage); |
ThomasBGill | 13:2195ec8bc9ff | 1001 | |
ThomasBGill | 13:2195ec8bc9ff | 1002 | lcd.clear(); |
ThomasBGill | 15:05a227f970c2 | 1003 | lcd.printString("You drink the", 0, 0); |
ThomasBGill | 15:05a227f970c2 | 1004 | lcd.printString("potion and", 0, 1); |
ThomasBGill | 15:05a227f970c2 | 1005 | lcd.printString("suddenly feel", 0, 2); |
ThomasBGill | 15:05a227f970c2 | 1006 | lcd.printString("ill.", 0, 3); |
ThomasBGill | 15:05a227f970c2 | 1007 | lcd.printString("You take", 0, 4); |
ThomasBGill | 15:05a227f970c2 | 1008 | lcd.printString(buffer, 0, 5); |
ThomasBGill | 13:2195ec8bc9ff | 1009 | lcd.refresh(); |
ThomasBGill | 15:05a227f970c2 | 1010 | wait(1.0); |
ThomasBGill | 15:05a227f970c2 | 1011 | Sleep(); |
ThomasBGill | 15:05a227f970c2 | 1012 | |
ThomasBGill | 15:05a227f970c2 | 1013 | //Check if player is dead |
ThomasBGill | 15:05a227f970c2 | 1014 | if(ph < 0) { |
ThomasBGill | 15:05a227f970c2 | 1015 | GameOver(); |
ThomasBGill | 15:05a227f970c2 | 1016 | } |
ThomasBGill | 15:05a227f970c2 | 1017 | } else if(p == 1) { //Teleport |
ThomasBGill | 12:30a242706847 | 1018 | |
ThomasBGill | 15:05a227f970c2 | 1019 | lcd.clear(); |
ThomasBGill | 15:05a227f970c2 | 1020 | lcd.printString("You drink the", 0, 0); |
ThomasBGill | 15:05a227f970c2 | 1021 | lcd.printString("potion and", 0, 1); |
ThomasBGill | 15:05a227f970c2 | 1022 | lcd.printString("suddenly feel", 0, 2); |
ThomasBGill | 15:05a227f970c2 | 1023 | lcd.printString("your body", 0, 3); |
ThomasBGill | 15:05a227f970c2 | 1024 | lcd.printString("being", 0, 4); |
ThomasBGill | 15:05a227f970c2 | 1025 | lcd.printString("transported", 0, 5); |
ThomasBGill | 15:05a227f970c2 | 1026 | lcd.refresh(); |
ThomasBGill | 15:05a227f970c2 | 1027 | wait(1.0); |
ThomasBGill | 15:05a227f970c2 | 1028 | Sleep(); |
ThomasBGill | 15:05a227f970c2 | 1029 | |
ThomasBGill | 15:05a227f970c2 | 1030 | GameLoop(); |
ThomasBGill | 15:05a227f970c2 | 1031 | |
ThomasBGill | 15:05a227f970c2 | 1032 | } else { //Full heal |
ThomasBGill | 15:05a227f970c2 | 1033 | |
ThomasBGill | 15:05a227f970c2 | 1034 | ph = 15; |
ThomasBGill | 13:2195ec8bc9ff | 1035 | |
ThomasBGill | 13:2195ec8bc9ff | 1036 | lcd.clear(); |
ThomasBGill | 15:05a227f970c2 | 1037 | lcd.printString("You drink the", 0, 0); |
ThomasBGill | 15:05a227f970c2 | 1038 | lcd.printString("potion and", 0, 1); |
ThomasBGill | 15:05a227f970c2 | 1039 | lcd.printString("suddenly feel", 0, 2); |
ThomasBGill | 15:05a227f970c2 | 1040 | lcd.printString("all your", 0, 3); |
ThomasBGill | 15:05a227f970c2 | 1041 | lcd.printString("wounds heal", 0, 4); |
ThomasBGill | 13:2195ec8bc9ff | 1042 | lcd.refresh(); |
ThomasBGill | 15:05a227f970c2 | 1043 | wait(1.0); |
ThomasBGill | 15:05a227f970c2 | 1044 | Sleep(); |
ThomasBGill | 13:2195ec8bc9ff | 1045 | } |
ThomasBGill | 15:05a227f970c2 | 1046 | } else { //Leave the potion |
ThomasBGill | 15:05a227f970c2 | 1047 | DirFlag = 0; |
ThomasBGill | 15:05a227f970c2 | 1048 | StartFlag = 0; |
ThomasBGill | 15:05a227f970c2 | 1049 | lcd.clear(); |
ThomasBGill | 15:05a227f970c2 | 1050 | lcd.printString("You walk away", 0, 0); |
ThomasBGill | 15:05a227f970c2 | 1051 | lcd.printString("and leave the", 0, 1); |
ThomasBGill | 15:05a227f970c2 | 1052 | lcd.printString("potion", 0, 2); |
ThomasBGill | 15:05a227f970c2 | 1053 | lcd.refresh(); |
ThomasBGill | 15:05a227f970c2 | 1054 | wait(1.0); |
ThomasBGill | 15:05a227f970c2 | 1055 | Sleep(); |
ThomasBGill | 15:05a227f970c2 | 1056 | } |
ThomasBGill | 15:05a227f970c2 | 1057 | } |
ThomasBGill | 13:2195ec8bc9ff | 1058 | |
ThomasBGill | 15:05a227f970c2 | 1059 | void Chest() |
ThomasBGill | 15:05a227f970c2 | 1060 | { |
ThomasBGill | 15:05a227f970c2 | 1061 | int c = rand()%4; //0- Item, 1- Booby trap, 2- Map, Else- Potion |
ThomasBGill | 13:2195ec8bc9ff | 1062 | |
ThomasBGill | 15:05a227f970c2 | 1063 | if(c == 0) { |
ThomasBGill | 15:05a227f970c2 | 1064 | getItem(); |
ThomasBGill | 15:05a227f970c2 | 1065 | } else if(c == 1) { |
ThomasBGill | 15:05a227f970c2 | 1066 | BoobyTrap(); |
ThomasBGill | 15:05a227f970c2 | 1067 | } else if(c == 2) { |
ThomasBGill | 15:05a227f970c2 | 1068 | RevealMap(); |
ThomasBGill | 15:05a227f970c2 | 1069 | } else { |
ThomasBGill | 15:05a227f970c2 | 1070 | Potion(); |
ThomasBGill | 12:30a242706847 | 1071 | } |
ThomasBGill | 15:05a227f970c2 | 1072 | |
ThomasBGill | 15:05a227f970c2 | 1073 | map[px][py] = CHEST_OPENED; |
ThomasBGill | 15:05a227f970c2 | 1074 | |
ThomasBGill | 12:30a242706847 | 1075 | } |
ThomasBGill | 12:30a242706847 | 1076 | |
ThomasBGill | 10:59c874d006ab | 1077 | void GameLoop() |
ThomasBGill | 10:59c874d006ab | 1078 | { |
ThomasBGill | 10:59c874d006ab | 1079 | while(1) { |
ThomasBGill | 10:59c874d006ab | 1080 | |
ThomasBGill | 11:b86a15d26de9 | 1081 | level++; |
ThomasBGill | 11:b86a15d26de9 | 1082 | |
ThomasBGill | 11:b86a15d26de9 | 1083 | World(); |
ThomasBGill | 11:b86a15d26de9 | 1084 | |
ThomasBGill | 11:b86a15d26de9 | 1085 | LevelScreen(); |
ThomasBGill | 18:98ea2b787894 | 1086 | |
ThomasBGill | 18:98ea2b787894 | 1087 | RevealMap(); |
ThomasBGill | 11:b86a15d26de9 | 1088 | |
ThomasBGill | 11:b86a15d26de9 | 1089 | while(1) { |
ThomasBGill | 11:b86a15d26de9 | 1090 | |
ThomasBGill | 16:a26d7519830e | 1091 | ActFlag = 0; |
ThomasBGill | 16:a26d7519830e | 1092 | StartFlag = 0; |
ThomasBGill | 16:a26d7519830e | 1093 | DirFlag = 0; |
ThomasBGill | 16:a26d7519830e | 1094 | |
ThomasBGill | 11:b86a15d26de9 | 1095 | PlayerCamera(); |
ThomasBGill | 12:30a242706847 | 1096 | |
ThomasBGill | 12:30a242706847 | 1097 | if(map[px][py] == CHEST) { |
ThomasBGill | 12:30a242706847 | 1098 | Chest(); |
ThomasBGill | 12:30a242706847 | 1099 | } |
ThomasBGill | 12:30a242706847 | 1100 | |
ThomasBGill | 12:30a242706847 | 1101 | if(px == exx && py == exy) { |
ThomasBGill | 12:30a242706847 | 1102 | |
ThomasBGill | 12:30a242706847 | 1103 | break; |
ThomasBGill | 12:30a242706847 | 1104 | |
ThomasBGill | 12:30a242706847 | 1105 | } |
ThomasBGill | 12:30a242706847 | 1106 | |
ThomasBGill | 11:b86a15d26de9 | 1107 | Sleep(); |
ThomasBGill | 10:59c874d006ab | 1108 | |
ThomasBGill | 10:59c874d006ab | 1109 | |
ThomasBGill | 11:b86a15d26de9 | 1110 | if(DirFlag) { |
ThomasBGill | 11:b86a15d26de9 | 1111 | |
ThomasBGill | 11:b86a15d26de9 | 1112 | DirFlag = 0; |
ThomasBGill | 10:59c874d006ab | 1113 | |
ThomasBGill | 11:b86a15d26de9 | 1114 | PlayerMove(); |
ThomasBGill | 13:2195ec8bc9ff | 1115 | |
ThomasBGill | 18:98ea2b787894 | 1116 | if(rand()%50 == 0) { |
ThomasBGill | 13:2195ec8bc9ff | 1117 | Fight(); |
ThomasBGill | 13:2195ec8bc9ff | 1118 | } |
ThomasBGill | 13:2195ec8bc9ff | 1119 | |
ThomasBGill | 11:b86a15d26de9 | 1120 | } |
ThomasBGill | 11:b86a15d26de9 | 1121 | if(StartFlag) { |
ThomasBGill | 10:59c874d006ab | 1122 | |
ThomasBGill | 11:b86a15d26de9 | 1123 | StartFlag = 0; |
ThomasBGill | 10:59c874d006ab | 1124 | |
ThomasBGill | 11:b86a15d26de9 | 1125 | StartMenu(); |
ThomasBGill | 11:b86a15d26de9 | 1126 | } |
ThomasBGill | 13:2195ec8bc9ff | 1127 | if(ActFlag) { |
ThomasBGill | 13:2195ec8bc9ff | 1128 | |
ThomasBGill | 13:2195ec8bc9ff | 1129 | ActFlag = 0; |
ThomasBGill | 13:2195ec8bc9ff | 1130 | } |
ThomasBGill | 10:59c874d006ab | 1131 | } |
ThomasBGill | 10:59c874d006ab | 1132 | } |
ThomasBGill | 10:59c874d006ab | 1133 | } |
ThomasBGill | 10:59c874d006ab | 1134 | |
ThomasBGill | 10:59c874d006ab | 1135 | void MainMenu() |
ThomasBGill | 10:59c874d006ab | 1136 | { |
ThomasBGill | 13:2195ec8bc9ff | 1137 | level = 0; |
ThomasBGill | 13:2195ec8bc9ff | 1138 | |
ThomasBGill | 13:2195ec8bc9ff | 1139 | //Player Health |
ThomasBGill | 13:2195ec8bc9ff | 1140 | ph = 15; |
ThomasBGill | 13:2195ec8bc9ff | 1141 | |
ThomasBGill | 13:2195ec8bc9ff | 1142 | //Player weapon |
ThomasBGill | 13:2195ec8bc9ff | 1143 | pw = 0; //0 to 4 |
ThomasBGill | 13:2195ec8bc9ff | 1144 | |
ThomasBGill | 13:2195ec8bc9ff | 1145 | //Player armour |
ThomasBGill | 13:2195ec8bc9ff | 1146 | pa = 5; //5 to 9 |
ThomasBGill | 13:2195ec8bc9ff | 1147 | |
ThomasBGill | 12:30a242706847 | 1148 | bool menu = 0; |
ThomasBGill | 10:59c874d006ab | 1149 | |
ThomasBGill | 10:59c874d006ab | 1150 | while(1) { |
ThomasBGill | 10:59c874d006ab | 1151 | lcd.clear(); |
ThomasBGill | 10:59c874d006ab | 1152 | if(menu == 0) { |
ThomasBGill | 10:59c874d006ab | 1153 | lcd.printString("New Game <", 20, 1); |
ThomasBGill | 10:59c874d006ab | 1154 | lcd.printString("Options",20,3); |
ThomasBGill | 10:59c874d006ab | 1155 | lcd.refresh(); |
ThomasBGill | 10:59c874d006ab | 1156 | Sleep(); |
ThomasBGill | 10:59c874d006ab | 1157 | } else { |
ThomasBGill | 10:59c874d006ab | 1158 | lcd.printString("New Game", 20, 1); |
ThomasBGill | 10:59c874d006ab | 1159 | lcd.printString("Options <",20,3); |
ThomasBGill | 10:59c874d006ab | 1160 | lcd.refresh(); |
ThomasBGill | 10:59c874d006ab | 1161 | Sleep(); |
ThomasBGill | 10:59c874d006ab | 1162 | } |
ThomasBGill | 10:59c874d006ab | 1163 | |
ThomasBGill | 10:59c874d006ab | 1164 | if(DirFlag) { |
ThomasBGill | 10:59c874d006ab | 1165 | |
ThomasBGill | 10:59c874d006ab | 1166 | DirFlag = 0; |
ThomasBGill | 10:59c874d006ab | 1167 | |
ThomasBGill | 10:59c874d006ab | 1168 | menu = !menu; |
ThomasBGill | 10:59c874d006ab | 1169 | } |
ThomasBGill | 13:2195ec8bc9ff | 1170 | if(ActFlag) { |
ThomasBGill | 10:59c874d006ab | 1171 | |
ThomasBGill | 10:59c874d006ab | 1172 | ActFlag = 0; |
ThomasBGill | 10:59c874d006ab | 1173 | |
ThomasBGill | 13:2195ec8bc9ff | 1174 | if(menu == 0) { |
ThomasBGill | 13:2195ec8bc9ff | 1175 | GameLoop(); |
ThomasBGill | 13:2195ec8bc9ff | 1176 | } |
ThomasBGill | 10:59c874d006ab | 1177 | } |
ThomasBGill | 10:59c874d006ab | 1178 | } |
ThomasBGill | 9:3cad581b5419 | 1179 | } |
ThomasBGill | 8:ee857f0147aa | 1180 | |
ThomasBGill | 0:9200b3c387ed | 1181 | int main() |
ThomasBGill | 0:9200b3c387ed | 1182 | { |
ThomasBGill | 1:0f774d41584c | 1183 | //Power Saving |
ThomasBGill | 1:0f774d41584c | 1184 | PHY_PowerDown (); |
ThomasBGill | 1:0f774d41584c | 1185 | int result = semihost_powerdown(); |
ThomasBGill | 1:0f774d41584c | 1186 | |
ThomasBGill | 10:59c874d006ab | 1187 | Up.rise(&DirPressed); |
ThomasBGill | 10:59c874d006ab | 1188 | Down.rise(&DirPressed); |
ThomasBGill | 10:59c874d006ab | 1189 | Right.rise(&DirPressed); |
ThomasBGill | 10:59c874d006ab | 1190 | Left.rise(&DirPressed); |
ThomasBGill | 9:3cad581b5419 | 1191 | Start.rise(&StartPressed); |
ThomasBGill | 10:59c874d006ab | 1192 | Act.rise(&ActPressed); |
ThomasBGill | 9:3cad581b5419 | 1193 | |
ThomasBGill | 1:0f774d41584c | 1194 | //Generate random seed |
ThomasBGill | 0:9200b3c387ed | 1195 | srand(Noise*1000000); |
ThomasBGill | 1:0f774d41584c | 1196 | |
ThomasBGill | 1:0f774d41584c | 1197 | //Initilize screen |
ThomasBGill | 0:9200b3c387ed | 1198 | lcd.init(); |
ThomasBGill | 8:ee857f0147aa | 1199 | |
ThomasBGill | 10:59c874d006ab | 1200 | Intro(); |
ThomasBGill | 9:3cad581b5419 | 1201 | |
ThomasBGill | 10:59c874d006ab | 1202 | MainMenu(); |
ThomasBGill | 9:3cad581b5419 | 1203 | |
ThomasBGill | 10:59c874d006ab | 1204 | } |