X Tutup
Skip to content

Commit 250d218

Browse files
MrMaderaEliteMasterEric
authored andcommitted
Add ability to press back to exit Character Select
1 parent 61c710f commit 250d218

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

source/funkin/ui/charSelect/CharSelectSubState.hx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,11 @@ class CharSelectSubState extends MusicBeatSubState
755755
FlxTween.tween(member, {y: member.y + 300}, 0.8, {ease: FlxEase.backIn});
756756
}
757757
FlxG.camera.follow(camFollow, LOCKON);
758+
// going to freeplay so fast makes the fade effects and the camera to bug, that's why we cancel the tweens
759+
FlxTween.cancelTweensOf(transitionGradient);
760+
FlxTween.cancelTweensOf(fadeShader);
761+
FlxTween.cancelTweensOf(camFollow);
762+
758763
FlxTween.tween(transitionGradient, {y: -150}, 0.8, {ease: FlxEase.backIn});
759764
fadeShader.fade(1.0, 0, 0.8, {ease: FlxEase.quadIn});
760765
FlxTween.tween(camFollow, {y: camFollow.y - 150}, 0.8,
@@ -764,7 +769,7 @@ class CharSelectSubState extends MusicBeatSubState
764769
FlxG.switchState(() -> FreeplayState.build(
765770
{
766771
{
767-
character: curChar,
772+
character: wentBackToFreeplay ? rememberedChar : curChar,
768773
fromCharSelect: true
769774
}
770775
}));
@@ -784,6 +789,8 @@ class CharSelectSubState extends MusicBeatSubState
784789
var mobileDeny:Bool = false;
785790
var mobileAccept:Bool = false;
786791

792+
var wentBackToFreeplay:Bool = false;
793+
787794
override public function update(elapsed:Float):Void
788795
{
789796
super.update(elapsed);
@@ -899,6 +906,14 @@ class CharSelectSubState extends MusicBeatSubState
899906
holdTmrRight = 0;
900907
selectSound.play(true);
901908
}
909+
910+
if (controls.BACK)
911+
{
912+
wentBackToFreeplay = true;
913+
FunkinSound.playOnce(Paths.sound('cancelMenu'));
914+
FlxTween.tween(FlxG.sound.music, {volume: 0.0}, 0.7, {ease: FlxEase.quadInOut});
915+
goToFreeplay();
916+
}
902917
}
903918

904919
if (cursorX < -1)

0 commit comments

Comments
 (0)
X Tutup