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
|
#include <iostream>
#include <windows.h>
#include <string>
#include <sstream>
using namespace std;
char map[20] [40] = {"#####################################",
"# # # # # # # # # #",
"# # # # # # # # # #",
"# # # # # # # # # #",
"#####################################",
"#####################################",
"# # # # # # # # # #",
"# # # # # # # # # #",
"# # # # # # # # # #",
"#####################################",
"#####################################",
"# # # # # # # # # #",
"# # # # # # # # # #",
"# # # # # # # # # #",
"#####################################",
"#####################################",
"# # # # # # # # # #",
"# @ # # # # # # # # #",
"# # # # # # # # # #",
"#####################################"};
int Gamespeed = 5;
int Level = 1;
bool stopgame = false;
int hp = 10;
int MaxHp = 10;
int mp = 15;
int MaxMana = 15;
int choice;
int Up = "Up";
int Down = "Down";
int Right = "Right";
int Left = "Left";
int main()
{
while(stopgame == false && Level == 1)
{
system("cls");
for (int y = 0; y < 20; y++)
{
cout << map[y] << endl;
}
cout << "Which Dorection would you like to go?\n";
cin >> choice;
for (int y = 0; y < 20; y++)
{
for (int x = 0; x < 40; x++)
{
switch (map[y][x])
{
case'@':
{
if (choice == Up)
{
int y2 = (y-1);
switch(map[y2][x])
{
case ' ':
{
map[y][x] = ' ';
y -= 1;
map[y2][x] = '@';
}break;
}
} //if (choice == Up)
if(choice == Down)
{
int y2 = (y+1);
switch(map[y2][x])
{
case ' ':
{
map[y][x] = ' ';
y += 1;
map[y2][x] = '@';
}break;
}
} //if(choice == Down)
if(choice == Right)
{
int x2 = (x+1);
switch(map[y][x2])
{
case ' ':
{
map[y][x] = ' ';
x += 1;
map[y][x2] = '@';
}break;
}
} //if(choice == Right)
if(choice == Left)
{
int x2 = (x-1);
switch(map[y][x2])
{
case ' ':
{
map[y][x] = ' ';
x -= 1;
map[y][x2] = '@';
}break;
}
} //if(choice == Left)
}break; // case'@':
} // switch (map[y][x])
} // for (int x = 0; x < 40; x++)
} // for (int y = 0; y < 20; y++)
} // while(stopgame == false && Level == 1)
return 0;
} // int main
|