Browse Source

Zurücksetzen Spielstand

remotes/origin/branchJulia
fdai8040 11 months ago
parent
commit
9d072197a9
  1. 8
      src/main/c/Pong/game.c

8
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
}

Loading…
Cancel
Save