Added speed boost after a certain amount of bricks remain

Reset board after all bricks are destroyed
This commit is contained in:
BlueNutterfly 2018-11-11 21:50:30 +04:00
parent 78d0a72217
commit 711a5548ef
2 changed files with 7 additions and 0 deletions

View File

@ -60,6 +60,10 @@ public class BrickBuster extends ApplicationAdapter {
}
ball.update(dt);
paddle.update(dt);
if (getBricks().isEmpty()) {
create();
playing = false;
}
}
@Override

View File

@ -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;