Only check for paddle collision when ball position <= paddle height.
This commit is contained in:
parent
d3eb876960
commit
d89a20134b
@ -75,7 +75,7 @@ public class Ball extends Entity {
|
|||||||
return;
|
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();
|
Pair<Vector2, Vector2> paddle = getBrickBuster().getPaddle().getTopEdge();
|
||||||
Vector2 lineDir = paddle.getValue().sub(paddle.getKey());
|
Vector2 lineDir = paddle.getValue().sub(paddle.getKey());
|
||||||
Vector2 nearest = Utils.nearestPoint(paddle.getKey().cpy(), lineDir, new_pos.cpy());
|
Vector2 nearest = Utils.nearestPoint(paddle.getKey().cpy(), lineDir, new_pos.cpy());
|
||||||
|
Loading…
Reference in New Issue
Block a user