1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280
|
#include <cstdlib>
#include <iostream>
#include "roomone.h"
#include "roomtwo.h"
using namespace std;
//Object Prototyping
RoomOne ob;
void startUp();
void playerCommand();
void room1();
void room2();
void room3();
void room4();
void room5();
void room6();
void room7();
//Integers
int map[9][9] =
{ {0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0},
{0,0,0,6,0,0,0,0,0},
{0,0,2,3,5,7,0,0,0},
{0,0,1,0,4,0,0,0,0},
{0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0}},
currentX = 2, currentY = 6,
room = map[currentY][currentX],
health = 100,
score = 0;
//Charachters
char roomName[10] = {"The Runes"},
north[6] = {"North"},
command[10];
//Boolean
bool game = 1,
validMove = 0,
itemsHolding[20] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
int main(int argc, char *argv[])
{
startUp();
//Main Game
do
{
room = map[currentY][currentX];
cout << " ------------------------------------------------------------------------------\n";
cout << " Score: " << score << " Location: " << room << " Health: " << health << "\n";
cout << " ------------------------------------------------------------------------------\n\n";
switch(room)
{
case 1:
ob.Description();
break;
case 2:
room2();
break;
case 3:
room3();
break;
case 4:
room4();
break;
case 5:
room5();
break;
case 6:
room6();
break;
case 7:
room7();
break;
default:
cout << "You are outside the map\n";
}
playerCommand();
system("CLS");
//game = 0;
}
while(game==1);
return EXIT_SUCCESS;
}
void playerCommand()
{
validMove = 0;
while(validMove==0)
{
cout << " Enter Command: ";
cin >> command;
if (!stricmp(command, "North")) //Move North
{
currentY = currentY - 1;
if(map[currentY][currentX]==0)
{
cout << "\n You can't move that way!\n\n ";
currentY = currentY + 1;
system("PAUSE");
}
else
cout << " You moved North\n ";
validMove = 1;
}
else if (!stricmp(command, "East")) //Move East
{
currentX = currentX + 1;
if(map[currentY][currentX]==0)
{
cout << "\n You can't move that way!\n\n ";
currentX = currentX - 1;
system("PAUSE");
}
else
cout << " You moved East\n ";
validMove = 1;
}
else if (!stricmp(command, "South")) //Move South
{
currentY = currentY + 1;
if(map[currentY][currentX]==0)
{
cout << "\n You can't move that way!\n\n ";
currentY = currentY - 1;
system("PAUSE");
}
else
cout << " You moved South\n ";
validMove = 1;
}
else if (!stricmp(command, "West")) //Move West
{
currentX = currentX - 1;
if(map[currentY][currentX]==0)
{
cout << "\n You can't move that way!\n\n ";
currentX = currentX + 1;
system("PAUSE");
}
else
cout << " You moved West\n ";
validMove = 1;
}
else if (!stricmp(command, "Inventory")) //Inventory
{
}
else if (!stricmp(command, "Look")) //Loo
{
}
else if (!stricmp(command, "Pick Up")) //Pick Up
{
}
else if (!stricmp(command, "Use")) //Use
{
}
else if (!stricmp(command, "Help")) //Help
{
system("CLS");
startUp();
validMove = 1;
}
else if (!stricmp(command, "Quit")) //Quit
{
game = 0;
system("CLS");
cout << "\n Created by Aaron Walwyn. Pre-Alpha 15/05/12. Copyrighth 2012 ©.\n\n ";
system("pause");
validMove = 1;
}
}
}
void startUp()
{
cout << "\n # # # #\n"
<< " # # # #### ##### # ##### # # \n"
<< " # # # # # # # # # # # # \n"
<< " # # # # # # # # # # # \n"
<< " # # # # # ##### # # # # # \n"
<< " # # # # # # # # # # # # \n"
<< " ## ## #### # # ###### ##### # #\n\n";
cout << " Controls: \n ---------\n"
<< " North\n"
<< " East\n"
<< " South\n"
<< " West\n\n"
<< " Inventory\n"
<< " Look\n"
<< " Pick Up\n"
<< " Use\n\n"
<< " Help\n"
<< " Quit\n\n ";
system("PAUSE");
system ("CLS");
}
void room1() //Room One Program
{
cout << " You find yourself in a cell, around \n\n";
}
void room2() //Room Two Program
{
cout << " You are in Room Two (Hallway outside Cell 01).\n\n";
}
void room3() //Room Three Program
{
cout << " You are in Room Three ().\n\n";
}
void room4() //Room Four Program
{
cout << " You are in Room Four ().\n\n";
}
void room5() //Room Five Program
{
cout << " You are in Room Five ().\n\n";
}
void room6() //Room Six Program
{
cout << " You are in Room Six ().\n\n";
}
void room7() //Room Seven Program
{
cout << " You are in Room Seven ().\n\n";
}
/* Inventory Items and their codes
bool item[20]
0 = Rusty Key
1 =
2 =
3 =
4 =
5 =
6 =
7 =
8 =
9 =
10 =
11 =
12 =
13 =
14 =
15 =
16 =
17 =
18 =
19 =
*/
|