Only check for paddle collision when ball position <= paddle height.

This commit is contained in:
Matt Low 2018-11-12 11:50:50 +04:00
parent d3eb876960
commit d89a20134b

View File

@ -75,7 +75,7 @@ public class Ball extends Entity {
return;
}
if (direction.y < 0) {
if (direction.y < 0 && new_pos.y <= Paddle.PADDLE_Y + Paddle.PADDLE_HEIGHT + RADIUS) {
Pair<Vector2, Vector2> paddle = getBrickBuster().getPaddle().getTopEdge();
Vector2 lineDir = paddle.getValue().sub(paddle.getKey());
Vector2 nearest = Utils.nearestPoint(paddle.getKey().cpy(), lineDir, new_pos.cpy());