diff --git a/src/itdelatrisu/opsu/GameScore.java b/src/itdelatrisu/opsu/GameScore.java index 2d59d6c7..530031ba 100644 --- a/src/itdelatrisu/opsu/GameScore.java +++ b/src/itdelatrisu/opsu/GameScore.java @@ -159,6 +159,11 @@ public class GameScore { */ private long score; + /** + * Displayed game score (for animation, slightly behind score). + */ + private long scoreDisplay; + /** * Current health bar percentage. */ @@ -249,6 +254,7 @@ public class GameScore { */ public void clear() { score = 0; + scoreDisplay = 0; health = 100f; hitResultCount = new int[HIT_MAX]; hitResultList = new LinkedList(); @@ -432,7 +438,7 @@ public class GameScore { */ public void drawGameElements(Graphics g, int mapLength, boolean breakPeriod, boolean firstObject) { // score - drawSymbolString(String.format("%08d", score), + drawSymbolString(String.format("%08d", scoreDisplay), width - 2, 0, 1.0f, true); // score percentage @@ -670,8 +676,21 @@ public class GameScore { return GRADE_D; } + /** + * Updates the score display based on a delta value. + * @param delta the delta interval since the last call + */ + public void updateScoreDisplay(int delta) { + if (scoreDisplay < score) { + scoreDisplay += (score - scoreDisplay) * delta / 50 + 1; + if (scoreDisplay > score) + scoreDisplay = score; + } + } + /** * Updates combo burst data based on a delta value. + * @param delta the delta interval since the last call */ public void updateComboBurst(int delta) { if (comboBurstIndex > -1 && Options.isComboBurstEnabled()) { diff --git a/src/itdelatrisu/opsu/states/Game.java b/src/itdelatrisu/opsu/states/Game.java index a7575ffb..1b691079 100644 --- a/src/itdelatrisu/opsu/states/Game.java +++ b/src/itdelatrisu/opsu/states/Game.java @@ -498,6 +498,8 @@ public class Game extends BasicGameState { return; } + score.updateScoreDisplay(delta); + // map complete! if (objectIndex >= osu.objects.length) { game.enterState(Opsu.STATE_GAMERANKING, new FadeOutTransition(Color.black), new FadeInTransition(Color.black)); @@ -558,6 +560,8 @@ public class Game extends BasicGameState { game.enterState(Opsu.STATE_GAMEPAUSEMENU); } + score.updateComboBurst(delta); + // drain health score.changeHealth(delta / -200f); if (!score.isAlive()) { @@ -566,8 +570,6 @@ public class Game extends BasicGameState { game.enterState(Opsu.STATE_GAMEPAUSEMENU); } - score.updateComboBurst(delta); - // update objects (loop in unlikely event of any skipped indexes) while (objectIndex < osu.objects.length && trackPosition > osu.objects[objectIndex].time) { OsuHitObject hitObject = osu.objects[objectIndex];