Move any stuck balls along with paddle when shields get added/removed

This commit is contained in:
Matt Low 2018-11-13 12:54:09 +04:00
parent 7588a0986b
commit 1c7e20f8e9

View File

@ -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() {