1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-15 11:22:55 +00:00

gf/nene char select mini optimization

This commit is contained in:
Cameron Taylor 2024-08-29 14:32:10 -04:00
parent b27aa4c94d
commit 0392eddba6

View file

@ -21,6 +21,8 @@ class CharSelectGF extends FlxAtlasSprite
var intendedYPos:Float = 0; var intendedYPos:Float = 0;
var intendedAlpha:Float = 0; var intendedAlpha:Float = 0;
var curGF:GFChar = GF;
public function new() public function new()
{ {
super(0, 0, Paths.animateAtlas("charSelect/gfChill")); super(0, 0, Paths.animateAtlas("charSelect/gfChill"));
@ -28,7 +30,7 @@ class CharSelectGF extends FlxAtlasSprite
switchGF("bf"); switchGF("bf");
} }
override public function update(elapsed:Float) override public function update(elapsed:Float):Void
{ {
super.update(elapsed); super.update(elapsed);
@ -63,7 +65,7 @@ class CharSelectGF extends FlxAtlasSprite
* @param animInfo Should not be confused with animInInfo! * @param animInfo Should not be confused with animInInfo!
* This is merely a local var for the function! * This is merely a local var for the function!
*/ */
function doFade(animInfo:FramesJSFLInfo) function doFade(animInfo:FramesJSFLInfo):Void
{ {
fadeTimer += FlxG.elapsed; fadeTimer += FlxG.elapsed;
if (fadeTimer >= 1 / 24) if (fadeTimer >= 1 / 24)
@ -101,26 +103,30 @@ class CharSelectGF extends FlxAtlasSprite
fadeAnimIndex = 0; fadeAnimIndex = 0;
} }
public function switchGF(str:String) /**
* For switching between "GFs" such as gf, nene, etc
* @param bf Which BF we are selecting, so that we know the accompyaning GF
*/
public function switchGF(bf:String):Void
{ {
str = switch (str) var prevGF:GFChar = curGF;
switch (bf)
{ {
case "pico": case "pico":
"nene"; curGF = NENE;
case "bf": case "bf":
"gf"; curGF = GF;
default: default:
"gf"; curGF = GF;
} }
switch str // We don't need to update any anims if we didn't change GF
{ if (prevGF == curGF) return;
default:
loadAtlas(Paths.animateAtlas("charSelect/" + str + "Chill"));
}
animInInfo = FramesJSFLParser.parse(Paths.file("images/charSelect/" + str + "AnimInfo/" + str + "In.txt")); loadAtlas(Paths.animateAtlas("charSelect/" + curGF + "Chill"));
animOutInfo = FramesJSFLParser.parse(Paths.file("images/charSelect/" + str + "AnimInfo/" + str + "Out.txt"));
animInInfo = FramesJSFLParser.parse(Paths.file("images/charSelect/" + curGF + "AnimInfo/" + curGF + "In.txt"));
animOutInfo = FramesJSFLParser.parse(Paths.file("images/charSelect/" + curGF + "AnimInfo/" + curGF + "Out.txt"));
anim.play(""); anim.play("");
playAnimation("idle", true, false, true); playAnimation("idle", true, false, true);
@ -135,3 +141,9 @@ enum FadeStatus
FADE_OUT; FADE_OUT;
FADE_IN; FADE_IN;
} }
enum abstract GFChar(String) from String to String
{
var GF = "gf";
var NENE = "nene";
}