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 OsuHitObjectResult(int time, int result, float x, float y, Color color) { */ private long score; + /** + * Displayed game score (for animation, slightly behind score). + */ + private long scoreDisplay; + /** * Current health bar percentage. */ @@ -249,6 +254,7 @@ public GameScore(int width, int height) { */ public void clear() { score = 0; + scoreDisplay = 0; health = 100f; hitResultCount = new int[HIT_MAX]; hitResultList = new LinkedList(); @@ -432,7 +438,7 @@ private void drawSymbolString(String str, int x, int y, float scale, boolean rig */ 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 @@ else if (hit300ratio >= 60f) 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 @@ else if (!container.hasFocus()) { 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 @@ else if (!container.hasFocus()) { game.enterState(Opsu.STATE_GAMEPAUSEMENU); } + score.updateComboBurst(delta); + // drain health score.changeHealth(delta / -200f); if (!score.isAlive()) { @@ -566,8 +570,6 @@ else if (!container.hasFocus()) { 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];