Browse Source

update

main
fdai4616 2 years ago
parent
commit
4f7cc9dec0
  1. 5
      src/main/java/PingPong/CollisionChecker.java

5
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);
}
}
Loading…
Cancel
Save