diff --git a/src/de/bricked/game/Game.java b/src/de/bricked/game/Game.java index c565ff78b75206a21fdf9fe3ba93044e6e375428..48846459eacd718c9cc24bc3c2068dd4f8d71ec2 100644 --- a/src/de/bricked/game/Game.java +++ b/src/de/bricked/game/Game.java @@ -15,6 +15,7 @@ import logger.Logger; public class Game { + private final int MAX_LIVES = 7; private Settings settings; private LevelPack levelPack; private Level level; @@ -28,8 +29,7 @@ public class Game private int pointsSinceLastMultiplicatorReset; private int multiplicator; private LevelController levelController; - private ArrayList<PowerUp> movingPowerUps; - private ArrayList<PowerUp> activatedPowerUps; + private ArrayList<PowerUp> movingPowerUps; public Game() { @@ -43,10 +43,13 @@ public class Game this.multiplicator = 0; this.pointsSinceLastMultiplicatorReset = 0; this.levelController = null; - this.movingPowerUps = new ArrayList<>(); - this.activatedPowerUps = new ArrayList<>(); - } + this.movingPowerUps = new ArrayList<>(); + } + public int getMaxLives() + { + return MAX_LIVES; + } public Settings getSettings() { return settings; @@ -176,16 +179,6 @@ public class Game this.movingPowerUps = movingPowerUps; } - public ArrayList<PowerUp> getActivatedPowerUps() - { - return activatedPowerUps; - } - - public void setActivatedPowerUps(ArrayList<PowerUp> activatedPowerUps) - { - this.activatedPowerUps = activatedPowerUps; - } - public Point2D reflectBall(HitLocation hitLocation, Point2D direction) { switch(hitLocation) diff --git a/src/de/bricked/game/powerups/ExtraLifePowerUp.java b/src/de/bricked/game/powerups/ExtraLifePowerUp.java index 55de70cec527e26d8ee25280491af294d8f85bf7..8bd1fbec2efdb618be81f53bb19b5c04ca477f4f 100644 --- a/src/de/bricked/game/powerups/ExtraLifePowerUp.java +++ b/src/de/bricked/game/powerups/ExtraLifePowerUp.java @@ -13,7 +13,7 @@ public class ExtraLifePowerUp extends PowerUp @Override public void activate(LevelController levelController, Game game) { - if(game.getLivesRemaining() - 1 < levelController.MAX_LIVES) + if(game.getLivesRemaining() - 1 < game.getMaxLives()) { game.setLivesRemaining(game.getLivesRemaining() + 1); levelController.refreshLiveCounter(); diff --git a/src/de/bricked/ui/LevelController.java b/src/de/bricked/ui/LevelController.java index bbc4aa457ac0553b2bbf694b7b863b7f3a8cce3c..44467afa71fa93870b0897454f6fd0cbb400ef99 100644 --- a/src/de/bricked/ui/LevelController.java +++ b/src/de/bricked/ui/LevelController.java @@ -89,8 +89,7 @@ public class LevelController private static GridPane grid; private AnimationTimer timer; private double gamePaneWidth; - private double gamePaneHeight; - public final int MAX_LIVES = 7; + private double gamePaneHeight; private final int TARGET_FPS = 60; private final long OPTIMAL_TIME = 1000000000 / TARGET_FPS; private final static double BRICK_FADE_DURATION = 300.0; @@ -674,7 +673,7 @@ public class LevelController { ImageView iv = new ImageView(new Image("de/bricked/resources/textures/paddle/paddle-small.png")); iv.setFitWidth(70); - iv.setFitHeight(120 / MAX_LIVES); + iv.setFitHeight(120 / game.getMaxLives()); vboxLives.getChildren().add(iv); } } @@ -1029,8 +1028,7 @@ public class LevelController game.resetPointsSinceLastMultiplicatorReset(); game.setBoard(null); game.setLevelController(null); - game.setMovingPowerUps(new ArrayList<>()); - game.setActivatedPowerUps(new ArrayList<>()); + game.setMovingPowerUps(new ArrayList<>()); anchorPaneGame.requestFocus(); }