From 711a5548ef7cfddfbe1844f2e4308c7bc1bac7c0 Mon Sep 17 00:00:00 2001 From: BlueNutterfly Date: Sun, 11 Nov 2018 21:50:30 +0400 Subject: [PATCH] Added speed boost after a certain amount of bricks remain Reset board after all bricks are destroyed --- core/src/com/me/brickbuster/BrickBuster.java | 4 ++++ core/src/com/me/brickbuster/entity/Ball.java | 3 +++ 2 files changed, 7 insertions(+) diff --git a/core/src/com/me/brickbuster/BrickBuster.java b/core/src/com/me/brickbuster/BrickBuster.java index 409b3c8..920e035 100644 --- a/core/src/com/me/brickbuster/BrickBuster.java +++ b/core/src/com/me/brickbuster/BrickBuster.java @@ -60,6 +60,10 @@ public class BrickBuster extends ApplicationAdapter { } ball.update(dt); paddle.update(dt); + if (getBricks().isEmpty()) { + create(); + playing = false; + } } @Override diff --git a/core/src/com/me/brickbuster/entity/Ball.java b/core/src/com/me/brickbuster/entity/Ball.java index 9768613..c2c721c 100644 --- a/core/src/com/me/brickbuster/entity/Ball.java +++ b/core/src/com/me/brickbuster/entity/Ball.java @@ -51,6 +51,9 @@ public class Ball extends Entity { if (nearest.dst(new_pos.x, new_pos.y) <= RADIUS) { brickIterator.remove(); + if (getBrickBuster().getBricks().size() <= 39) { + speed = 8; + } Utils.reflect(direction, segment.nor()); brick_collision = true; break;