2024-06-15 04:59:58 +00:00
|
|
|
package funkin.ui.charSelect;
|
|
|
|
|
2025-08-29 03:47:40 +00:00
|
|
|
import funkin.graphics.FunkinSprite;
|
2024-09-01 07:22:34 +00:00
|
|
|
import funkin.modding.IScriptedClass.IBPMSyncedScriptedClass;
|
|
|
|
import funkin.modding.events.ScriptEvent;
|
2025-07-05 02:21:33 +00:00
|
|
|
import funkin.ui.FullScreenScaleMode;
|
|
|
|
import flixel.math.FlxPoint;
|
2024-06-15 04:59:58 +00:00
|
|
|
|
2025-08-29 03:47:40 +00:00
|
|
|
class CharSelectPlayer extends FunkinSprite implements IBPMSyncedScriptedClass
|
2024-06-15 04:59:58 +00:00
|
|
|
{
|
2025-06-11 09:46:21 +00:00
|
|
|
var initialX:Float = 0;
|
|
|
|
var initialY:Float = 0;
|
|
|
|
|
2024-06-15 04:59:58 +00:00
|
|
|
public function new(x:Float, y:Float)
|
|
|
|
{
|
2025-06-11 09:46:21 +00:00
|
|
|
initialX = x;
|
|
|
|
initialY = y;
|
|
|
|
|
2025-08-29 03:47:40 +00:00
|
|
|
super(x, y);
|
|
|
|
|
|
|
|
loadTextureAtlas("charSelect/bfChill",
|
2025-07-05 02:21:33 +00:00
|
|
|
{
|
2025-08-30 03:44:11 +00:00
|
|
|
applyStageMatrix: true,
|
|
|
|
swfMode: true
|
2025-07-05 02:21:33 +00:00
|
|
|
});
|
2024-06-15 04:59:58 +00:00
|
|
|
|
2025-08-29 03:47:40 +00:00
|
|
|
anim.onFinish.add(function(animLabel:String) {
|
2024-08-28 00:48:56 +00:00
|
|
|
switch (animLabel)
|
|
|
|
{
|
|
|
|
case "slidein":
|
2024-09-01 07:22:34 +00:00
|
|
|
if (hasAnimation("slidein idle point"))
|
|
|
|
{
|
2025-08-29 03:47:40 +00:00
|
|
|
anim.play("slidein idle point", true);
|
2024-09-01 07:22:34 +00:00
|
|
|
}
|
2024-08-28 00:48:56 +00:00
|
|
|
else
|
2024-09-01 07:22:34 +00:00
|
|
|
{
|
2025-08-29 03:47:40 +00:00
|
|
|
anim.play("idle", true);
|
|
|
|
anim.curAnim.looped = true;
|
2024-09-01 07:22:34 +00:00
|
|
|
}
|
2024-09-09 06:23:46 +00:00
|
|
|
case "deselect":
|
2025-08-29 03:47:40 +00:00
|
|
|
anim.play("deselect loop start", true);
|
2024-09-11 23:37:32 +00:00
|
|
|
case "slidein idle point", "cannot select Label", "unlock":
|
2025-08-29 03:47:40 +00:00
|
|
|
anim.play("idle", true);
|
2024-09-01 07:22:34 +00:00
|
|
|
case "idle":
|
|
|
|
trace('Waiting for onBeatHit');
|
2024-08-28 00:48:56 +00:00
|
|
|
}
|
2024-06-15 04:59:58 +00:00
|
|
|
});
|
2024-08-22 21:36:43 +00:00
|
|
|
}
|
|
|
|
|
2024-09-01 07:22:34 +00:00
|
|
|
public function onStepHit(event:SongTimeScriptEvent):Void {}
|
|
|
|
|
|
|
|
public function onBeatHit(event:SongTimeScriptEvent):Void
|
|
|
|
{
|
|
|
|
// TODO: There's a minor visual bug where there's a little stutter.
|
|
|
|
// This happens because the animation is getting restarted while it's already playing.
|
|
|
|
// I tried make this not interrupt an existing idle,
|
|
|
|
// but isAnimationFinished() and isLoopComplete() both don't work! What the hell?
|
|
|
|
// danceEvery isn't necessary if that gets fixed.
|
2024-09-09 06:23:46 +00:00
|
|
|
//
|
2024-09-01 07:22:34 +00:00
|
|
|
if (getCurrentAnimation() == "idle")
|
|
|
|
{
|
2025-08-29 03:47:40 +00:00
|
|
|
anim.play("idle", true);
|
2024-09-01 07:22:34 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2025-07-05 02:21:33 +00:00
|
|
|
public function switchChar(str:String):Void
|
2024-06-15 04:59:58 +00:00
|
|
|
{
|
2025-08-29 03:47:40 +00:00
|
|
|
frames = CharSelectAtlasHandler.loadAtlas('charSelect/${str}Chill');
|
2024-06-15 04:59:58 +00:00
|
|
|
|
2025-08-29 03:47:40 +00:00
|
|
|
anim.play("slidein", true);
|
2024-06-15 04:59:58 +00:00
|
|
|
|
|
|
|
updateHitbox();
|
|
|
|
}
|
2024-09-01 07:22:34 +00:00
|
|
|
|
|
|
|
public function onScriptEvent(event:ScriptEvent):Void {};
|
|
|
|
|
|
|
|
public function onCreate(event:ScriptEvent):Void {};
|
|
|
|
|
|
|
|
public function onDestroy(event:ScriptEvent):Void {};
|
|
|
|
|
|
|
|
public function onUpdate(event:UpdateScriptEvent):Void {};
|
2024-06-15 04:59:58 +00:00
|
|
|
}
|