diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index 472a7f5e9c0..cc6ad6c7ad5 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -693,6 +693,9 @@ class PlayState extends MusicBeatSubState { initStage(); initCharacters(); + + // Set animation speed AFTER initializing the characters, so that their animation speeds get updated too. + currentStage.animationSpeed = playbackRate; } else { @@ -861,7 +864,11 @@ class PlayState extends MusicBeatSubState vocals.playerVolume = 1; vocals.opponentVolume = 1; - if (currentStage != null) currentStage.resetStage(); + if (currentStage != null) + { + currentStage.resetStage(); + currentStage.animationSpeed = playbackRate; + } if (!fromDeathState) { @@ -929,7 +936,7 @@ class PlayState extends MusicBeatSubState Conductor.instance.formatOffset = 0.0; } - Conductor.instance.update(Conductor.instance.songPosition + elapsed * 1000, false); // Normal conductor update. + Conductor.instance.update(Conductor.instance.songPosition + elapsed * 1000 * playbackRate, false); // Normal conductor update. // If, after updating the conductor, the instrumental has finished, end the song immediately. // This helps prevent a major bug where the level suddenly loops back to the start or middle. diff --git a/source/funkin/play/stage/Stage.hx b/source/funkin/play/stage/Stage.hx index cf432a52abe..92922108302 100644 --- a/source/funkin/play/stage/Stage.hx +++ b/source/funkin/play/stage/Stage.hx @@ -44,6 +44,25 @@ class Stage extends FlxSpriteGroup implements IPlayStateScriptedClass implements return _data?.cameraZoom ?? 1.0; } + /** + * The animation speed of objects. + */ + public var animationSpeed(default, set):Float = 1.0; + + function set_animationSpeed(value:Float) + { + for (member in this.members) + { + if (member?.animation == null) continue; + member.animation.timeScale /= this.animationSpeed; + member.animation.timeScale *= value; + } + + this.animationSpeed = value; + + return animationSpeed; + } + var frameBufferMan:FrameBufferManager; /**