diff --git a/src/main/c/Pong/game.c b/src/main/c/Pong/game.c index 877ea22..4d72e10 100644 --- a/src/main/c/Pong/game.c +++ b/src/main/c/Pong/game.c @@ -91,12 +91,12 @@ int main(){ while (1) { //Steuerung für Schläger 1 - if (kbhit()){ + if (!isPaused && kbhit()){ char input = getch(); - if (input == 'w' && paddle1PositionY > 1 && !isPaused) + if (input == 'w' && paddle1PositionY > 1) { paddle1PositionY--; - } else if (input == 's' && paddle1PositionY < HEIGHT - PADDLE_LENGTH - 1 && !isPaused) { + } else if (input == 's' && paddle1PositionY < HEIGHT - PADDLE_LENGTH - 1) { paddle1PositionY++; } else if (input == 'p') { isPaused = !isPaused; @@ -104,11 +104,11 @@ int main(){ } //Steuerung für Schläger 2 - if (kbhit()){ + if (!isPaused && kbhit()){ char input = getch(); - if (input == 'i' && paddle2PositionY > 1 && !isPaused) { + if (input == 'i' && paddle2PositionY > 1){ paddle2PositionY--; - } else if (input == 'k' && paddle2PositionY < HEIGHT - PADDLE_LENGTH - 1 && !isPaused){ + } else if (input == 'k' && paddle2PositionY < HEIGHT - PADDLE_LENGTH - 1){ paddle2PositionY++; } else if (input == 'p') { isPaused = !isPaused; @@ -117,6 +117,7 @@ int main(){ //Wenn Pauseiert if (isPaused) { + drawField(paddle1PositionY, paddle2PositionY, ball, score1, score2, 1); continue; }