From a2c8b9e3a82d9d5683ea6785186213eb40727ce8 Mon Sep 17 00:00:00 2001 From: chrislo27 Date: Sun, 4 Oct 2020 17:54:35 -0700 Subject: [PATCH] Fix incorrect frame counting in credits --- .../io/github/chrislo27/rhre3/credits/CreditsGame.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/src/main/kotlin/io/github/chrislo27/rhre3/credits/CreditsGame.kt b/core/src/main/kotlin/io/github/chrislo27/rhre3/credits/CreditsGame.kt index 03f10b0c2..f03e6f5d6 100644 --- a/core/src/main/kotlin/io/github/chrislo27/rhre3/credits/CreditsGame.kt +++ b/core/src/main/kotlin/io/github/chrislo27/rhre3/credits/CreditsGame.kt @@ -204,6 +204,7 @@ class CreditsGame(main: RHRE3Application, val speedMultiplier: Float = 1f) private var dancersFaceState = TimedDanceState(0, D_FACE) private var vocalistFaceState = TimedDanceState(0, D_FACE) private var leadFaceState = TimedDanceState(0, D_FACE) + private var frameWait: Float = 0f private var currentFrame: Int = 0 private var frameUsedSax: Int = 0 @@ -563,7 +564,12 @@ class CreditsGame(main: RHRE3Application, val speedMultiplier: Float = 1f) } } - currentFrame++ + frameWait += delta + val sixtieth = 1 / 60f + while (frameWait > sixtieth) { + frameWait -= sixtieth + currentFrame++ + } if (currentFrame - dancersState.startFrame >= dancersState.danceState.durationFrames + dancersState.linger) { dancersState = TimedDanceState(currentFrame, D_READY) }