|
@ -103,6 +103,17 @@ int checkCollision(Ball ball, int paddle1PositionY, int paddle2PositionY) { |
|
|
ball.speedX = -ball.speedX; |
|
|
ball.speedX = -ball.speedX; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//Punkte zählen |
|
|
|
|
|
if (ball.x <= 0){ |
|
|
|
|
|
return 1; // Spieler 2 gewinnt Punkt |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (ball.x >= WIDTH - 1){ |
|
|
|
|
|
return 2; // Spieler 1 gewinnt Punkt |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return 0; // kein Punkt |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
int main(){ |
|
|
int main(){ |
|
|
int paddle1PositionY = HEIGHT / 2 - PADDLE_LENGTH / 2; |
|
|
int paddle1PositionY = HEIGHT / 2 - PADDLE_LENGTH / 2; |
|
|