This commit is contained in:
Lasercar 2025-04-05 05:30:00 +10:00 committed by GitHub
commit a1925c5286
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 31 additions and 6 deletions

View file

@ -154,8 +154,9 @@ class CharSelectGF extends FlxAtlasSprite implements IBPMSyncedScriptedClass
/**
* For switching between "GFs" such as gf, nene, etc
* @param bf Which BF we are selecting, so that we know the accompyaning GF
* @param pressedSelect If select was pressed while switching character, play the confirm animation instead
*/
public function switchGF(bf:String):Void
public function switchGF(bf:String, pressedSelect:Bool = false):Void
{
var previousGFPath = currentGFPath;
@ -183,6 +184,8 @@ class CharSelectGF extends FlxAtlasSprite implements IBPMSyncedScriptedClass
animOutInfo = FramesJSFLParser.parse(animInfoPath + '/Out.txt');
}
if (pressedSelect) playAnimation("confirm", true, false, true);
else
playAnimation("idle", true, false, false);
updateHitbox();

View file

@ -6,6 +6,8 @@ import funkin.modding.events.ScriptEvent;
class CharSelectPlayer extends FlxAtlasSprite implements IBPMSyncedScriptedClass
{
var pressedSelect:Bool = false;
public function new(x:Float, y:Float)
{
super(x, y, Paths.animateAtlas("charSelect/bfChill"));
@ -16,10 +18,22 @@ class CharSelectPlayer extends FlxAtlasSprite implements IBPMSyncedScriptedClass
case "slidein":
if (hasAnimation("slidein idle point"))
{
if (pressedSelect)
{
playAnimation("select");
pressedSelect = false;
}
else
playAnimation("slidein idle point", true, false, false);
}
else
{
if (pressedSelect)
{
playAnimation("select");
pressedSelect = false;
}
else
playAnimation("idle", true, false, false);
}
case "deselect":
@ -63,7 +77,7 @@ class CharSelectPlayer extends FlxAtlasSprite implements IBPMSyncedScriptedClass
}
}
public function switchChar(str:String)
public function switchChar(str:String, pressedSelect:Bool = false)
{
switch str
{
@ -73,6 +87,8 @@ class CharSelectPlayer extends FlxAtlasSprite implements IBPMSyncedScriptedClass
playAnimation("slidein", true, false, false);
this.pressedSelect = pressedSelect;
updateHitbox();
updatePosition(str);

View file

@ -1038,10 +1038,16 @@ class CharSelectSubState extends MusicBeatSubState
if (pressedSelect && memb.animation.curAnim.name == "idle") memb.animation.play("confirm");
if (autoFollow && !pressedSelect && memb.animation.curAnim.name != "idle")
{
// Play the confirm animation in reverse
memb.animation.play("confirm", false, true);
member.animation.finishCallback = (_) -> {
member.animation.finishCallback = function(name:String):Void {
trace('Finish pixel animation: ${name}');
member.animation.play("idle");
member.animation.finishCallback = null;
// Reset the finish callback to what it was before
member.animation.finishCallback = function(name:String):Void {
trace('Finish pixel animation: ${name}');
if (name == 'confirm') member.animation.play('confirm-hold');
};
};
}
}
@ -1084,8 +1090,8 @@ class CharSelectSubState extends MusicBeatSubState
if (frame >= index + 1)
{
playerChill.visible = true;
playerChill.switchChar(value);
gfChill.switchGF(value);
playerChill.switchChar(value, pressedSelect);
gfChill.switchGF(value, pressedSelect);
gfChill.visible = true;
}
if (frame >= index + 2)