From 9d072197a96f32b73dc6e9c05c80256455b21d53 Mon Sep 17 00:00:00 2001 From: fdai8040 Date: Wed, 31 Jan 2024 17:10:03 +0000 Subject: [PATCH] =?UTF-8?q?Zur=C3=BCcksetzen=20Spielstand?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/Pong/game.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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 }