diff --git a/src/main/c/Pong/game.c b/src/main/c/Pong/game.c index f97a3f0..69d6a31 100644 --- a/src/main/c/Pong/game.c +++ b/src/main/c/Pong/game.c @@ -24,6 +24,7 @@ void drawField(int paddle1PositionY, int paddle2PositionY) { } } + int main(){ int paddle1PositionY = HEIGHT / 2 - PADDLE_LENGTH / 2; int paddle2PositionY = HEIGHT / 2 - PADDLE_LENGTH / 2; @@ -39,7 +40,15 @@ int main(){ } } -// Hier Steuerung für Schläger 2 noch reinschreiben +//Steuerung für Schläger 2 + if (kbhit()){ + char input = getch(); + if (input == 'i' && paddle2PositionY > 1) { + paddle2PositionY--; + } else if (input == 'k' && paddle2PositionY < HEIGHT - PADDLE_LENGTH - 1){ + paddle2PositionY++; + } + } draw Field(paddle1PositionY, paddle2PositionY);