Funkin/source/funkin/ui/charSelect/CharSelectPlayer.hx

65 lines
1.5 KiB
Haxe
Raw Normal View History

2024-06-15 00:59:58 -04:00
package funkin.ui.charSelect;
import flixel.FlxSprite;
import funkin.graphics.adobeanimate.FlxAtlasSprite;
2024-08-27 20:48:56 -04:00
import flxanimate.animate.FlxKeyFrame;
2024-06-15 00:59:58 -04:00
class CharSelectPlayer extends FlxAtlasSprite
{
2024-08-27 20:48:56 -04:00
var desLp:FlxKeyFrame = null;
2024-06-15 00:59:58 -04:00
public function new(x:Float, y:Float)
{
super(x, y, Paths.animateAtlas("charSelect/bfChill"));
2024-08-27 20:48:56 -04:00
desLp = anim.getFrameLabel("deselect loop start");
onAnimationComplete.add(function(animLabel:String) {
2024-08-27 20:48:56 -04:00
switch (animLabel)
{
case "slidein":
if (hasAnimation("slidein idle point")) playAnimation("slidein idle point", true, false, false);
else
playAnimation("idle", true, false, true);
case "slidein idle point":
playAnimation("idle", true, false, true);
}
2024-06-15 00:59:58 -04:00
});
2024-08-22 17:36:43 -04:00
2024-08-27 20:48:56 -04:00
onAnimationFrame.add(function(animLabel:String, frame:Int) {
if (animLabel == "deselect" && desLp != null && frame >= desLp.index) playAnimation("deselect loop start", true, false, true);
});
2024-08-22 17:36:43 -04:00
}
2024-06-15 00:59:58 -04:00
public function updatePosition(str:String)
{
switch (str)
{
case "bf":
x = 0;
y = 0;
case "pico":
x = 0;
y = 0;
case "random":
}
}
public function switchChar(str:String)
{
switch str
{
default:
loadAtlas(Paths.animateAtlas("charSelect/" + str + "Chill"));
}
playAnimation("slidein", true, false, false);
2024-08-27 20:48:56 -04:00
desLp = anim.getFrameLabel("deselect loop start");
2024-06-15 00:59:58 -04:00
updateHitbox();
updatePosition(str);
}
}