diff --git a/src/main/c/Pong/game.c b/src/main/c/Pong/game.c index 4f6008e..835c600 100644 --- a/src/main/c/Pong/game.c +++ b/src/main/c/Pong/game.c @@ -115,6 +115,12 @@ int checkCollision(Ball ball, int paddle1PositionY, int paddle2PositionY) { return 0; // kein Punkt } +//Reset +void resetScore(int *score1, int *score2) { + *score1 = 0; + *score2 = 0; +} + int main(){ int paddle1PositionY = HEIGHT / 2 - PADDLE_LENGTH / 2; int paddle2PositionY = HEIGHT / 2 - PADDLE_LENGTH / 2; @@ -173,6 +179,8 @@ int main(){ ball.speedX = -ball.speedX; } + resetScore(&score1, &score2); //Zurücksetzen Spielstand + drawField(paddle1PositionY, paddle2PositionY, ball, score1, score2, 0); usleep(100000); //Verlangsamen Schleife/Spiel }