java.lang.Object
project.pong.model.CollisionDetector
The CollisionDetector class detects collisions between the ball and rackets in the Pong game.
-
Constructor Summary
ConstructorsConstructorDescriptionCollisionDetector(GamePong pong) Constructs a CollisionDetector object with the specified GamePong instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidDetects collisions between the ball and rackets.(package private) voidupdateBall(Ball ball) Updates the ball's direction and speed after a collision.
-
Constructor Details
-
CollisionDetector
Constructs a CollisionDetector object with the specified GamePong instance.- Parameters:
pong- The GamePong instance.
-
-
Method Details
-
detectCollision
public void detectCollision()Detects collisions between the ball and rackets. -
updateBall
Updates the ball's direction and speed after a collision.- Parameters:
ball- The ball object.
-