Всем привет у меня тут игра и она тормозит. Просьба не писать чушь кто не знает как это исправить!
Помогите как исправить торможение в игре?
Код:
#include
#include
#include
#include
#include
using namespace std;
clearscreen();
bool active = true;
int x = 1;
int y = 1;
char map[10][20] = {
"##################",
"#$ #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"##################"
};
int main(){
for(;;){
clearscreen();
for (int i = 0; i < 10; i++){
cout << map[i] << endl;
}
system("pause>nul");
clearscreen();
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] = '$';
}
}
}
}
void clearscreen()
{
HANDLE hOut;
COORD Position;
hOut = GetStdHandle(STD_OUTPUT_HANDLE);
Position.X = 0;
Position.Y = 0;
SetConsoleCursorPosition(hOut, Position);
}
там после
using namespace std;
стоит
void clearscreen();
забыл написать
Что за игра?
игра шутер консольный
Интересно! Спрашивать чушь можно, а отвечать - нет
не хочешь не отвечай
просьба проигнорирована ))
закидывай код на pastebin.com, а сюда конкретику задачи и линк
