mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2024-11-27 01:55:52 -05:00
74 lines
1.6 KiB
Haxe
74 lines
1.6 KiB
Haxe
package;
|
|
|
|
import flixel.FlxG;
|
|
import flixel.FlxObject;
|
|
import flixel.FlxSubState;
|
|
import flixel.math.FlxPoint;
|
|
import flixel.util.FlxColor;
|
|
import flixel.util.FlxTimer;
|
|
|
|
class GameOverSubstate extends FlxSubState
|
|
{
|
|
var bf:Boyfriend;
|
|
var camFollow:FlxObject;
|
|
|
|
public function new(x:Float, y:Float)
|
|
{
|
|
super();
|
|
|
|
bf = new Boyfriend(x, y);
|
|
add(bf);
|
|
|
|
camFollow = new FlxObject(bf.getGraphicMidpoint().x, bf.getGraphicMidpoint().y, 1, 1);
|
|
add(camFollow);
|
|
|
|
FlxG.sound.play('assets/sounds/fnf_loss_sfx' + TitleState.soundExt);
|
|
|
|
// FlxG.camera.followLerp = 1;
|
|
// FlxG.camera.focusOn(FlxPoint.get(FlxG.width / 2, FlxG.height / 2));
|
|
FlxG.camera.scroll.set();
|
|
FlxG.camera.target = null;
|
|
|
|
bf.playAnim('firstDeath');
|
|
}
|
|
|
|
override function update(elapsed:Float)
|
|
{
|
|
super.update(elapsed);
|
|
|
|
if (FlxG.keys.justPressed.ENTER)
|
|
{
|
|
endBullshit();
|
|
}
|
|
|
|
if (bf.animation.curAnim.name == 'firstDeath' && bf.animation.curAnim.curFrame == 12)
|
|
{
|
|
FlxG.camera.follow(camFollow, LOCKON, 0.01);
|
|
}
|
|
|
|
if (bf.animation.curAnim.name == 'firstDeath' && bf.animation.curAnim.finished)
|
|
{
|
|
FlxG.sound.playMusic('assets/music/gameOver' + TitleState.soundExt);
|
|
}
|
|
}
|
|
|
|
var isEnding:Bool = false;
|
|
|
|
function endBullshit():Void
|
|
{
|
|
if (!isEnding)
|
|
{
|
|
isEnding = true;
|
|
bf.playAnim('deathConfirm', true);
|
|
FlxG.sound.music.stop();
|
|
FlxG.sound.play('assets/music/gameOverEnd' + TitleState.soundExt);
|
|
new FlxTimer().start(0.7, function(tmr:FlxTimer)
|
|
{
|
|
FlxG.camera.fade(FlxColor.BLACK, 2, false, function()
|
|
{
|
|
FlxG.switchState(new PlayState());
|
|
});
|
|
});
|
|
}
|
|
}
|
|
}
|