Quick console game plz no bad comments

#include <iostream>
#include "windows.h"

using namespace std;

char map[20][40] = {
"#######################################",
"#@ #",
"# #",
"# #",
"# #",
"# #",
"# #",
"#######################################"
};

int x=1;
int y=1;

bool game_running = true;

int main(){

while(game_running == true){
system("cls");
for(int display=0; display<10; display++){
cout << map[display] << endl;
}
system("pause>nul");

if(GetAsyncKeyState(VK_DOWN)){
int y2 = y+1;
if(map[y2][x] == ' '){
map[y][x] = ' ';
y++;
map[y][x] = '@';

}
}
if(GetAsyncKeyState(VK_UP)){
int y2 = y-1;
if(map[y2][x] == ' '){
map[y][x] = ' ';
y--;
map[y][x] = '@';
}
}
if(GetAsyncKeyState(VK_RIGHT)){
int x2 = x+1;
if(map[y][x2] == ' '){
map[y][x] = ' ';
x++;
map[y][x] = '@';
}
}
if(GetAsyncKeyState(VK_LEFT)){
int x2 = x-1;
if(map[y][x2] == ' '){
map[y][x] = ' ';
x--;
map[y][x] = '@';
}
}
}
return 0;
}




sorry i f### up you can change it if you know how
No negative comments? Not even good negative comments?
Whell you can lol im just saying dont say this sucks or i hate this you know the whole package
For starters:
- It's <Windows.h> and not "windows.h"
- You're using global variables - not only is this bad, but you actually have no excuse for using them like this since all your code is in your main function.
- All your code is in your main function (this will make it hard to refactor)
- You use the system command

But the number one problem is that you tried to make a game in the console. If you think you're ready to make a game, please don't make it in the console - it is actually a much more challenging task than simply learning to use a graphics library like SFML. I know you're comfortable with the console, but trust me - making games in the console is an incredibly difficult and frustrating thing to do and will not help you learn C++ better.
kk than you
Topic archived. No new replies allowed.