From ee7108757b609164379408632e7bd2fdf9cad320 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Mon, 7 Aug 2023 17:58:06 -0400 Subject: [PATCH] proper fav and # symbol move --- source/funkin/freeplayStuff/LetterSort.hx | 48 +++++++++++++++++------ 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/source/funkin/freeplayStuff/LetterSort.hx b/source/funkin/freeplayStuff/LetterSort.hx index eb12ecbbe..fc4bf9344 100644 --- a/source/funkin/freeplayStuff/LetterSort.hx +++ b/source/funkin/freeplayStuff/LetterSort.hx @@ -14,12 +14,13 @@ class LetterSort extends FlxTypedSpriteGroup { public var letters:Array = []; - var curSelection:Int = 0; + var curSelection:Int = 2; public var changeSelectionCallback:String->Void; var leftArrow:FlxSprite; var rightArrow:FlxSprite; + var grpSeperators:Array = []; public function new(x, y) { @@ -58,6 +59,8 @@ class LetterSort extends FlxTypedSpriteGroup // sep.animation.play("seperator"); sep.color = letter.color.getDarkened(darkness); add(sep); + + grpSeperators.push(sep); } rightArrow = new FlxSprite(380, 15).loadGraphic(Paths.image("freeplay/miniArrow")); @@ -78,16 +81,24 @@ class LetterSort extends FlxTypedSpriteGroup public function changeSelection(diff:Int = 0) { - var ezTimer:Int->FreeplayLetter->Float->Void = function(frameNum:Int, daLetter:FreeplayLetter, offsetNum:Float) { + var ezTimer:Int->FlxSprite->Float->Void = function(frameNum:Int, spr:FlxSprite, offsetNum:Float) { new FlxTimer().start(frameNum / 24, function(_) { - daLetter.offset.x = offsetNum; + spr.offset.x = offsetNum; }); }; - var positions:Array = [-10, -22, -67, 2, 0]; + var positions:Array = [-10, -22, 2, 0]; if (diff < 0) { + for (sep in grpSeperators) + { + ezTimer(0, sep, positions[0]); + ezTimer(1, sep, positions[1]); + ezTimer(2, sep, positions[2]); + ezTimer(3, sep, positions[3]); + } + for (index => letter in letters) { letter.offset.x = positions[0]; @@ -99,7 +110,7 @@ class LetterSort extends FlxTypedSpriteGroup new FlxTimer().start(2 / 24, function(_) { letter.offset.x = positions[2]; - if (index == 0) letter.visible = true; + if (index == 0.) letter.visible = true; }); if (index == 2) @@ -110,7 +121,6 @@ class LetterSort extends FlxTypedSpriteGroup } ezTimer(3, letter, positions[3]); - ezTimer(4, letter, positions[4]); } leftArrow.offset.x = 3; @@ -120,19 +130,27 @@ class LetterSort extends FlxTypedSpriteGroup } else if (diff > 0) { + for (sep in grpSeperators) + { + ezTimer(0, sep, -positions[0]); + ezTimer(1, sep, -positions[1]); + ezTimer(2, sep, -positions[2]); + ezTimer(3, sep, -positions[3]); + } // same timing and functions and shit as the left one... except to the right!! + for (index => letter in letters) { letter.offset.x = -positions[0]; new FlxTimer().start(1 / 24, function(_) { letter.offset.x = -positions[1]; - if (index == 4) letter.visible = false; + if (index == 0) letter.visible = false; }); new FlxTimer().start(2 / 24, function(_) { letter.offset.x = -positions[2]; - if (index == 4) letter.visible = true; + if (index == 0) letter.visible = true; }); if (index == 2) @@ -143,7 +161,6 @@ class LetterSort extends FlxTypedSpriteGroup } ezTimer(3, letter, -positions[3]); - ezTimer(4, letter, -positions[4]); } rightArrow.offset.x = -3; @@ -157,7 +174,7 @@ class LetterSort extends FlxTypedSpriteGroup if (curSelection >= letters[0].arr.length) curSelection = 0; for (letter in letters) - letter.changeLetter(diff, curSelection + 2); + letter.changeLetter(diff, curSelection); if (changeSelectionCallback != null) changeSelectionCallback(letters[2].arr[letters[2].curLetter]); // bullshit and long lol! } @@ -210,6 +227,7 @@ class FreeplayLetter extends FlxAtlasSprite if (curLetter >= arr.length) curLetter = 0; var animName:String = arr[curLetter] + " move"; + switch (arr[curLetter]) { case "I L": @@ -221,7 +239,13 @@ class FreeplayLetter extends FlxAtlasSprite } this.anim.play(animName); - if (curSelection != curLetter) this.anim.pause(); - updateHitbox(); + if (curSelection != curLetter) + { + trace(animName); + trace(curLetter); + trace(curSelection); + this.anim.pause(); + } + // updateHitbox(); } }