Use brick.hit() as a check for whether the brick should be removed.

This commit is contained in:
BlueNutterfly 2018-11-12 18:20:56 +04:00
parent e1c7fbb53f
commit 4a7c9215dd

View File

@ -61,8 +61,9 @@ public class Ball extends Entity {
Vector2 nearest = Utils.nearestPoint(v1.cpy(), segment, new_pos.cpy()); Vector2 nearest = Utils.nearestPoint(v1.cpy(), segment, new_pos.cpy());
if (nearest.dst(new_pos.x, new_pos.y) <= RADIUS) { if (nearest.dst(new_pos.x, new_pos.y) <= RADIUS) {
if (brick.hit()) {
brickIterator.remove(); brickIterator.remove();
brick.hit(); }
Utils.reflect(direction, segment.nor()); Utils.reflect(direction, segment.nor());
brickCollision = true; brickCollision = true;
break; break;