scusi ma potresti farlo in un modo più semplice, io ho fatto così per non fare uscire l'eroe if(cmd == 'q'){//esci dal gioco gameOver = false; } if(cmd == 'd' && hero_x < 99){ hero_x++; } if(cmd == 'a' && hero_x > 0){ hero_x--; } if(cmd == 'w' && hero_y > 0){ hero_y--; } if(cmd == 's' && hero_y < 19){ hero_y++; } ah e per pulire lo schermo basta che fai system("cls").