2023-11-07 04:04:22 -05:00
|
|
|
package funkin.play;
|
2021-02-14 19:03:02 -05:00
|
|
|
|
|
|
|
import flixel.FlxSprite;
|
|
|
|
import flixel.graphics.frames.FlxAtlasFrames;
|
2022-03-08 03:13:53 -05:00
|
|
|
import funkin.play.PlayState;
|
2024-02-22 18:55:24 -05:00
|
|
|
import funkin.graphics.FunkinSprite;
|
2023-11-07 04:04:22 -05:00
|
|
|
import funkin.ui.MusicBeatState;
|
2023-08-02 18:08:49 -04:00
|
|
|
import flixel.addons.transition.FlxTransitionableState;
|
2023-11-07 04:04:22 -05:00
|
|
|
import funkin.ui.mainmenu.MainMenuState;
|
2021-02-14 19:03:02 -05:00
|
|
|
|
|
|
|
class GitarooPause extends MusicBeatState
|
|
|
|
{
|
2023-01-22 22:25:45 -05:00
|
|
|
var replayButton:FlxSprite;
|
|
|
|
var cancelButton:FlxSprite;
|
|
|
|
|
|
|
|
var replaySelect:Bool = false;
|
|
|
|
|
2023-06-06 17:38:31 -04:00
|
|
|
var previousParams:PlayStateParams;
|
|
|
|
|
|
|
|
public function new(previousParams:PlayStateParams):Void
|
2023-01-22 22:25:45 -05:00
|
|
|
{
|
|
|
|
super();
|
2023-06-06 17:38:31 -04:00
|
|
|
|
|
|
|
this.previousParams = previousParams;
|
2023-01-22 22:25:45 -05:00
|
|
|
}
|
|
|
|
|
2023-06-06 17:38:31 -04:00
|
|
|
override function create():Void
|
2023-01-22 22:25:45 -05:00
|
|
|
{
|
|
|
|
if (FlxG.sound.music != null) FlxG.sound.music.stop();
|
|
|
|
|
2024-03-12 21:34:50 -04:00
|
|
|
var bg:FunkinSprite = FunkinSprite.create('pauseAlt/pauseBG');
|
2023-01-22 22:25:45 -05:00
|
|
|
add(bg);
|
|
|
|
|
2024-02-22 18:55:24 -05:00
|
|
|
var bf:FunkinSprite = FunkinSprite.createSparrow(0, 30, 'pauseAlt/bfLol');
|
2023-01-22 22:25:45 -05:00
|
|
|
bf.animation.addByPrefix('lol', "funnyThing", 13);
|
|
|
|
bf.animation.play('lol');
|
|
|
|
add(bf);
|
|
|
|
bf.screenCenter(X);
|
|
|
|
|
2024-02-22 18:55:24 -05:00
|
|
|
replayButton = FunkinSprite.createSparrow(FlxG.width * 0.28, FlxG.height * 0.7, 'pauseAlt/pauseUI');
|
2023-01-22 22:25:45 -05:00
|
|
|
replayButton.animation.addByPrefix('selected', 'bluereplay', 0, false);
|
|
|
|
replayButton.animation.appendByPrefix('selected', 'yellowreplay');
|
|
|
|
replayButton.animation.play('selected');
|
|
|
|
add(replayButton);
|
|
|
|
|
2024-02-22 18:55:24 -05:00
|
|
|
cancelButton = FunkinSprite.createSparrow(FlxG.width * 0.58, replayButton.y, 'pauseAlt/pauseUI');
|
2023-01-22 22:25:45 -05:00
|
|
|
cancelButton.animation.addByPrefix('selected', 'bluecancel', 0, false);
|
|
|
|
cancelButton.animation.appendByPrefix('selected', 'cancelyellow');
|
|
|
|
cancelButton.animation.play('selected');
|
|
|
|
add(cancelButton);
|
|
|
|
|
|
|
|
changeThing();
|
|
|
|
|
|
|
|
super.create();
|
|
|
|
}
|
|
|
|
|
2023-06-06 17:38:31 -04:00
|
|
|
override function update(elapsed:Float):Void
|
2023-01-22 22:25:45 -05:00
|
|
|
{
|
|
|
|
if (controls.UI_LEFT_P || controls.UI_RIGHT_P) changeThing();
|
|
|
|
|
|
|
|
if (controls.ACCEPT)
|
|
|
|
{
|
|
|
|
if (replaySelect)
|
|
|
|
{
|
2023-08-02 18:08:49 -04:00
|
|
|
FlxTransitionableState.skipNextTransIn = false;
|
|
|
|
FlxTransitionableState.skipNextTransOut = false;
|
2024-02-05 19:46:11 -05:00
|
|
|
FlxG.switchState(() -> new PlayState(previousParams));
|
2023-01-22 22:25:45 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2024-02-05 19:46:11 -05:00
|
|
|
FlxG.switchState(() -> new MainMenuState());
|
2023-01-22 22:25:45 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
super.update(elapsed);
|
|
|
|
}
|
|
|
|
|
|
|
|
function changeThing():Void
|
|
|
|
{
|
|
|
|
replaySelect = !replaySelect;
|
|
|
|
|
|
|
|
if (replaySelect)
|
|
|
|
{
|
|
|
|
cancelButton.animation.curAnim.curFrame = 0;
|
|
|
|
replayButton.animation.curAnim.curFrame = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cancelButton.animation.curAnim.curFrame = 1;
|
|
|
|
replayButton.animation.curAnim.curFrame = 0;
|
|
|
|
}
|
|
|
|
}
|
2021-02-14 19:03:02 -05:00
|
|
|
}
|