|
@ -115,6 +115,12 @@ int checkCollision(Ball ball, int paddle1PositionY, int paddle2PositionY) { |
|
|
return 0; // kein Punkt |
|
|
return 0; // kein Punkt |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//Reset |
|
|
|
|
|
void resetScore(int *score1, int *score2) { |
|
|
|
|
|
*score1 = 0; |
|
|
|
|
|
*score2 = 0; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
int main(){ |
|
|
int main(){ |
|
|
int paddle1PositionY = HEIGHT / 2 - PADDLE_LENGTH / 2; |
|
|
int paddle1PositionY = HEIGHT / 2 - PADDLE_LENGTH / 2; |
|
|
int paddle2PositionY = HEIGHT / 2 - PADDLE_LENGTH / 2; |
|
|
int paddle2PositionY = HEIGHT / 2 - PADDLE_LENGTH / 2; |
|
@ -173,6 +179,8 @@ int main(){ |
|
|
ball.speedX = -ball.speedX; |
|
|
ball.speedX = -ball.speedX; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
resetScore(&score1, &score2); //Zurücksetzen Spielstand |
|
|
|
|
|
|
|
|
drawField(paddle1PositionY, paddle2PositionY, ball, score1, score2, 0); |
|
|
drawField(paddle1PositionY, paddle2PositionY, ball, score1, score2, 0); |
|
|
usleep(100000); //Verlangsamen Schleife/Spiel |
|
|
usleep(100000); //Verlangsamen Schleife/Spiel |
|
|
} |
|
|
} |
|
|