Fixed*

ive been working on this since my last post but i added a monster('=') to it so far

monster('=') moves and takes off hp when you go 1 space in any vertical or horisontal from it.

also added score for how steps you take before you losse

Code:// made by marcus wiseman #include <iostream> #include <windows.h> #include <conio.h> using namespace std; // y x char Map[10][20] = { "###################", "#@ #", "# = = #", "# #", "# = #", "# #", "# = = #", "# #", "###################" }; int move; int PlayerX; int PlayerY; int MonsterX; int MonsterY; int HP = 100; int SCORE = 0; int main() { int exit = 0; while (exit == 0) { system("cls"); for (int i = 0; i < 10; i++) { cout << Map[i] << endl; } cout << "HP = " << HP << endl; cout << "Score = " << SCORE << endl; cout << "Press Q to quit" << endl; cout << "A,S,D,W To Move Around" << endl; if (HP <= 0) { system("cls"); cout << " You Have Died " << endl; Sleep(3000); cout << "Press Any Key To Restart" << endl; system("pause > nul"); HP = 100; SCORE = 0; main(); } char key = getch(); for (int y = 0; y < 10; y++) { for (int x = 0; x < 20; x++) { switch(Map[y][x]) { case '@': { if (key == 'a') { int x2 = (x - 1); switch(Map[y][x2]) { case ' ': { Map[y][x] = ' '; x -= 1; SCORE++; Map[y][x2] = '@'; }break; case '#': { }break; } } if (key == 'd') { int x2 = (x + 1); switch(Map[y][x2]) { case ' ': { Map[y][x] = ' '; x += 1; SCORE++; Map[y][x2] = '@'; }break; case '#': { }break; } } if (key == 's') { int y2 = (y + 1); switch(Map[y2][x]) { case ' ': { Map[y][x] = ' '; y += 1; SCORE++; Map[y2][x] = '@'; }break; case '#': { }break; } } if (key == 'w') { int y2 = (y - 1); switch(Map[y2][x]) { case ' ': { Map[y][x] = ' '; y -= 1; SCORE++; Map[y2][x] = '@'; }break; case '#': { }break; } } if (key == 'q') { exit = 1; } PlayerX = x; PlayerY = y; }break; case '=': { move = rand()%4 + 1; if (move == 1) { int x2 = (x - 1); switch(Map[y][x2]) { case ' ': { Map[y][x] = ' '; x -= 1; Map[y][x2] = '='; }break; case '#': { }break; } } if (move == 2) { int x2 = (x + 1); switch(Map[y][x2]) { case ' ': { Map[y][x] = ' '; x += 1; Map[y][x2] = '='; }break; case '#': { }break; } } if (move == 3) { int y2 = (y - 1); switch(Map[y2][x]) { case ' ': { Map[y][x] = ' '; y -= 1; Map[y2][x] = '='; }break; case '#': { }break; } } if (move == 4) { int y2 = (y + 1); switch(Map[y2][x]) { case ' ': { Map[y][x] = ' '; y += 1; Map[y2][x] = '='; }break; case '#': { }break; } } MonsterX = x; MonsterY = y; if (PlayerX == (x - 1)) { if (PlayerY == y) { HP -= 10; } } if (PlayerX == (x + 1)) { if (PlayerY == y) { HP -= 10; } } if (PlayerY == (y - 1)) { if (PlayerX == x) { HP -= 10; } } if (PlayerY == (y + 1)) { if (PlayerX == x) { HP -= 10; } } }break; } } } } return 0; }