From 4f7cc9dec0f9f8210152b3ba6dad09ae8078373d Mon Sep 17 00:00:00 2001 From: fdai4616 Date: Tue, 7 Feb 2023 22:55:24 +0100 Subject: [PATCH] update --- src/main/java/PingPong/CollisionChecker.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/PingPong/CollisionChecker.java b/src/main/java/PingPong/CollisionChecker.java index 6543814..c2cf1ca 100644 --- a/src/main/java/PingPong/CollisionChecker.java +++ b/src/main/java/PingPong/CollisionChecker.java @@ -1,7 +1,12 @@ package PingPong; +import java.awt.*; + public class CollisionChecker { public Boolean didTouchTopOrBottomEdge(Integer ballYCoordinate, Integer maxHeight) { return ballYCoordinate <= 0 || ballYCoordinate >= maxHeight; } + public Boolean didTouchPaddle(Rectangle ball, Rectangle paddle) { + return ball.intersects(paddle); + } }