From 06da64ac20f49719dfa2d8b944ceed585cf1ccb5 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Sat, 4 Dec 2021 22:52:21 -0500 Subject: [PATCH] some timing polish --- source/FreeplayState.hx | 5 +++++ source/freeplayStuff/SongMenuItem.hx | 20 ++++++++++++-------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/source/FreeplayState.hx b/source/FreeplayState.hx index 23b86963d..b0d56df7f 100644 --- a/source/FreeplayState.hx +++ b/source/FreeplayState.hx @@ -238,6 +238,11 @@ class FreeplayState extends MusicBeatSubstate funnyMenu.alpha = 0.5; funnyMenu.songText.visible = false; + new FlxTimer().start((1 / 24) * i, function(doShit) + { + funnyMenu.doJumpIn = true; + }); + new FlxTimer().start((0.09 * i) + 0.85, function(lerpTmr) { funnyMenu.doLerp = true; diff --git a/source/freeplayStuff/SongMenuItem.hx b/source/freeplayStuff/SongMenuItem.hx index f6c81d15d..cf9935ee2 100644 --- a/source/freeplayStuff/SongMenuItem.hx +++ b/source/freeplayStuff/SongMenuItem.hx @@ -20,6 +20,7 @@ class SongMenuItem extends FlxSpriteGroup public var targetPos:FlxPoint = new FlxPoint(); public var doLerp:Bool = false; + public var doJumpIn:Bool = false; public function new(x:Float, y:Float, song:String) { @@ -50,17 +51,20 @@ class SongMenuItem extends FlxSpriteGroup override function update(elapsed:Float) { - frameTicker += elapsed; - - if (frameTicker >= 1 / 24 && frameTypeBeat < xFrames.length) + if (doJumpIn) { - frameTicker = 0; + frameTicker += elapsed; - scale.x = xFrames[frameTypeBeat]; - scale.y = 1 / xFrames[frameTypeBeat]; - x = FlxG.width * xPosLerpLol[Std.int(Math.min(frameTypeBeat, xPosLerpLol.length - 1))]; + if (frameTicker >= 1 / 24 && frameTypeBeat < xFrames.length) + { + frameTicker = 0; - frameTypeBeat += 1; + scale.x = xFrames[frameTypeBeat]; + scale.y = 1 / xFrames[frameTypeBeat]; + x = FlxG.width * xPosLerpLol[Std.int(Math.min(frameTypeBeat, xPosLerpLol.length - 1))]; + + frameTypeBeat += 1; + } } if (doLerp)