diff --git a/core/src/zero1hd/rhythmbullet/ui/stages/GameHUD.java b/core/src/zero1hd/rhythmbullet/ui/stages/GameHUD.java index 5ce070a..fec6a4d 100755 --- a/core/src/zero1hd/rhythmbullet/ui/stages/GameHUD.java +++ b/core/src/zero1hd/rhythmbullet/ui/stages/GameHUD.java @@ -15,6 +15,7 @@ import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; import zero1hd.rhythmbullet.ui.builders.HealthBar; import zero1hd.rhythmbullet.ui.windows.FPSWindow; import zero1hd.rhythmbullet.ui.windows.PauseMenu; +import zero1hd.rhythmbullet.util.ScoreManager; public class GameHUD extends Stage { private Label scoreLabel; @@ -26,13 +27,13 @@ public class GameHUD extends Stage { private Image leftStatusBar; private Image rightStatusBar; private Music music; - + private ScoreManager sm; public GameHUD(Skin skin, float maxHealth, GamePlayArea gpa) { super(); scoreLabel = new Label("Score: 0", skin, "default-font", Color.WHITE); scoreLabel.setPosition(10f, Gdx.graphics.getHeight()-scoreLabel.getHeight() - 10f); addActor(scoreLabel); - + this.sm = gpa.score; pause = new ImageButton(skin.getDrawable("pause"), skin.getDrawable("pause-down")); pause.setPosition(Gdx.graphics.getWidth() - pause.getWidth() - 15f, @@ -77,6 +78,14 @@ public class GameHUD extends Stage { setStatusColor(1, 1, 1, 0.5f); } + @Override + public void act(float delta) { + if (sm.checkDifferent()) { + setScore(sm.getScore()); + } + super.act(delta); + } + /** * sets the label for scoring to the designated score * @param score designated score diff --git a/core/src/zero1hd/rhythmbullet/util/ScoreManager.java b/core/src/zero1hd/rhythmbullet/util/ScoreManager.java index ff09380..433ab40 100755 --- a/core/src/zero1hd/rhythmbullet/util/ScoreManager.java +++ b/core/src/zero1hd/rhythmbullet/util/ScoreManager.java @@ -1,7 +1,8 @@ package zero1hd.rhythmbullet.util; public class ScoreManager { - public int score; + private int score; + private boolean different; public void setScore(int score) { this.score = score; @@ -14,4 +15,10 @@ public class ScoreManager { public void addScore(int addedScore) { score += addedScore; } + + public boolean checkDifferent() { + boolean current = different; + different = false; + return current; + } }