|
@ -1,7 +1,12 @@ |
|
|
package PingPong; |
|
|
package PingPong; |
|
|
|
|
|
|
|
|
|
|
|
import java.awt.*; |
|
|
|
|
|
|
|
|
public class CollisionChecker { |
|
|
public class CollisionChecker { |
|
|
public Boolean didTouchTopOrBottomEdge(Integer ballYCoordinate, Integer maxHeight) { |
|
|
public Boolean didTouchTopOrBottomEdge(Integer ballYCoordinate, Integer maxHeight) { |
|
|
return ballYCoordinate <= 0 || ballYCoordinate >= maxHeight; |
|
|
return ballYCoordinate <= 0 || ballYCoordinate >= maxHeight; |
|
|
} |
|
|
} |
|
|
|
|
|
public Boolean didTouchPaddle(Rectangle ball, Rectangle paddle) { |
|
|
|
|
|
return ball.intersects(paddle); |
|
|
|
|
|
} |
|
|
} |
|
|
} |