From 4a7c9215dde64c8aac412f3889b427714645e024 Mon Sep 17 00:00:00 2001 From: BlueNutterfly Date: Mon, 12 Nov 2018 18:20:56 +0400 Subject: [PATCH] Use brick.hit() as a check for whether the brick should be removed. --- core/src/com/me/brickbuster/entity/Ball.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/com/me/brickbuster/entity/Ball.java b/core/src/com/me/brickbuster/entity/Ball.java index fad8bed..9ea847c 100644 --- a/core/src/com/me/brickbuster/entity/Ball.java +++ b/core/src/com/me/brickbuster/entity/Ball.java @@ -61,8 +61,9 @@ public class Ball extends Entity { Vector2 nearest = Utils.nearestPoint(v1.cpy(), segment, new_pos.cpy()); if (nearest.dst(new_pos.x, new_pos.y) <= RADIUS) { - brickIterator.remove(); - brick.hit(); + if (brick.hit()) { + brickIterator.remove(); + } Utils.reflect(direction, segment.nor()); brickCollision = true; break;