From 11ffc6223893ef676fd17f0401c6c812a83ab77e Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Sun, 6 Aug 2023 22:20:18 -0400 Subject: [PATCH] new letters --- assets | 2 +- source/funkin/FreeplayState.hx | 3 ++ source/funkin/Paths.hx | 4 +- source/funkin/freeplayStuff/LetterSort.hx | 56 ++++++++++++++++------- 4 files changed, 46 insertions(+), 19 deletions(-) diff --git a/assets b/assets index 7bc9407e0..f6d6e839a 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 7bc9407e0e8141a643605ff4514ba63169cc41e2 +Subproject commit f6d6e839a86208279bf92e0b07b8c02b25913947 diff --git a/source/funkin/FreeplayState.hx b/source/funkin/FreeplayState.hx index 5ddd47432..277db9873 100644 --- a/source/funkin/FreeplayState.hx +++ b/source/funkin/FreeplayState.hx @@ -1026,7 +1026,10 @@ class DifficultySelector extends FlxSprite whiteShader.colorSet = true; + scale.x = scale.y = 0.5; + new FlxTimer().start(2 / 24, function(tmr) { + scale.x = scale.y = 1; whiteShader.colorSet = false; updateHitbox(); }); diff --git a/source/funkin/Paths.hx b/source/funkin/Paths.hx index c8c9c79b7..07a15dae1 100644 --- a/source/funkin/Paths.hx +++ b/source/funkin/Paths.hx @@ -49,9 +49,9 @@ class Paths return getPath(file, type, library); } - public static inline function animateAtlas(path:String, library:String) + public static inline function animateAtlas(path:String, ?library:String) { - return getLibraryPathForce('images/$path', library); + return getLibraryPath('images/$path', library); } inline static public function txt(key:String, ?library:String) diff --git a/source/funkin/freeplayStuff/LetterSort.hx b/source/funkin/freeplayStuff/LetterSort.hx index 44261bee1..b02eb0a92 100644 --- a/source/funkin/freeplayStuff/LetterSort.hx +++ b/source/funkin/freeplayStuff/LetterSort.hx @@ -7,6 +7,8 @@ import flixel.group.FlxSpriteGroup.FlxTypedSpriteGroup; import flixel.tweens.FlxTween; import flixel.tweens.FlxEase; import flixel.util.FlxColor; +import flixel.util.FlxTimer; +import funkin.graphics.adobeanimate.FlxAtlasSprite; class LetterSort extends FlxTypedSpriteGroup { @@ -16,11 +18,14 @@ class LetterSort extends FlxTypedSpriteGroup public var changeSelectionCallback:String->Void; + var leftArrow:FreeplayLetter; + var rightArrow:FreeplayLetter; + public function new(x, y) { super(x, y); - var leftArrow:FreeplayLetter = new FreeplayLetter(-20, 20); + leftArrow = new FreeplayLetter(-20, 15); leftArrow.animation.play("arrow"); leftArrow.flipX = true; add(leftArrow); @@ -50,7 +55,7 @@ class LetterSort extends FlxTypedSpriteGroup add(sep); } - var rightArrow:FreeplayLetter = new FreeplayLetter(380, 20); + rightArrow = new FreeplayLetter(380, leftArrow.y); rightArrow.animation.play("arrow"); add(rightArrow); @@ -67,6 +72,21 @@ class LetterSort extends FlxTypedSpriteGroup public function changeSelection(diff:Int = 0) { + if (diff < 0) + { + leftArrow.offset.x = 3; + new FlxTimer().start(2 / 24, function(_) { + leftArrow.offset.x = 0; + }); + } + else if (diff > 0) + { + rightArrow.offset.x = -3; + new FlxTimer().start(2 / 24, function(_) { + rightArrow.offset.x = 0; + }); + } + curSelection += diff; if (curSelection < 0) curSelection = letters.length - 1; if (curSelection >= letters.length) curSelection = 0; @@ -78,7 +98,7 @@ class LetterSort extends FlxTypedSpriteGroup } } -class FreeplayLetter extends FlxSprite +class FreeplayLetter extends FlxAtlasSprite { public var arr:Array = []; @@ -88,26 +108,30 @@ class FreeplayLetter extends FlxSprite public function new(x:Float, y:Float, ?letterInd:Int) { - super(x, y); - frames = Paths.getSparrowAtlas("freeplay/letterStuff"); + super(x, y, Paths.animateAtlas("freeplay/sortedLetters")); + // frames = Paths.getSparrowAtlas("freeplay/letterStuff"); + // this.anim.play("AB"); + // trace(this.anim.symbolDictionary); - var alphabet:String = "abcdefghijklmnopqrstuvwxyz"; - arr = alphabet.split(""); + var alphabet:String = "AB-CD-EH-I L-MN-OR-s-t-UZ"; + arr = alphabet.split("-"); arr.insert(0, "ALL"); - arr.insert(0, "#"); arr.insert(0, "fav"); + arr.insert(0, "#"); - for (str in arr) - { - animation.addByPrefix(str, str + " "); // string followed by a space! intentional! - } + // trace(arr); - animation.addByPrefix("arrow", "mini arrow"); - animation.addByPrefix("seperator", "seperator"); + // for (str in arr) + // { + // animation.addByPrefix(str, str + " "); // string followed by a space! intentional! + // } + + // animation.addByPrefix("arrow", "mini arrow"); + // animation.addByPrefix("seperator", "seperator"); if (letterInd != null) { - animation.play(arr[letterInd]); + this.anim.play(arr[letterInd]); curLetter = letterInd; } } @@ -119,6 +143,6 @@ class FreeplayLetter extends FlxSprite if (curLetter < 0) curLetter = arr.length - 1; if (curLetter >= arr.length) curLetter = 0; - animation.play(arr[curLetter]); + this.anim.play(arr[curLetter]); } }