From 1c7e20f8e94a9399d5106019ed9b1150d30a56e9 Mon Sep 17 00:00:00 2001 From: Matt Low Date: Tue, 13 Nov 2018 12:54:09 +0400 Subject: [PATCH] Move any stuck balls along with paddle when shields get added/removed --- core/src/com/me/brickbuster/state/PlayState.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/src/com/me/brickbuster/state/PlayState.java b/core/src/com/me/brickbuster/state/PlayState.java index 6c77b8a..202fbd8 100644 --- a/core/src/com/me/brickbuster/state/PlayState.java +++ b/core/src/com/me/brickbuster/state/PlayState.java @@ -122,11 +122,21 @@ public class PlayState extends State { public void addShield() { shieldCount++; paddle.setY(paddle.getY() + SHIELD_HEIGHT); + for (Ball ball : balls) { + if (ball.isStuck()) { + ball.setY(ball.getY() + SHIELD_HEIGHT); + } + } } public void removeShield() { shieldCount--; paddle.setY(paddle.getY() - SHIELD_HEIGHT); + for (Ball ball : balls) { + if (ball.isStuck()) { + ball.setY(ball.getY() - SHIELD_HEIGHT); + } + } } public void ballReset() {