2020-10-27 10:35:23 +00:00
|
|
|
package;
|
|
|
|
|
|
|
|
import flixel.FlxG;
|
|
|
|
import flixel.FlxObject;
|
|
|
|
import flixel.FlxSubState;
|
|
|
|
import flixel.math.FlxPoint;
|
2020-10-28 07:03:32 +00:00
|
|
|
import flixel.util.FlxColor;
|
|
|
|
import flixel.util.FlxTimer;
|
2020-10-27 10:35:23 +00:00
|
|
|
|
2020-10-28 09:26:33 +00:00
|
|
|
class GameOverSubstate extends MusicBeatSubstate
|
2020-10-27 10:35:23 +00:00
|
|
|
{
|
|
|
|
var bf:Boyfriend;
|
|
|
|
var camFollow:FlxObject;
|
|
|
|
|
2020-11-01 09:55:02 +00:00
|
|
|
// var
|
|
|
|
|
2020-10-27 10:35:23 +00:00
|
|
|
public function new(x:Float, y:Float)
|
|
|
|
{
|
|
|
|
super();
|
|
|
|
|
2020-10-28 09:26:33 +00:00
|
|
|
Conductor.songPosition = 0;
|
|
|
|
|
2020-10-27 10:35:23 +00:00
|
|
|
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);
|
2020-10-28 09:26:33 +00:00
|
|
|
Conductor.changeBPM(100);
|
2020-10-27 10:35:23 +00:00
|
|
|
|
|
|
|
// 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);
|
|
|
|
|
2020-11-01 07:58:20 +00:00
|
|
|
if (controls.ACCEPT)
|
2020-10-28 07:03:32 +00:00
|
|
|
{
|
|
|
|
endBullshit();
|
|
|
|
}
|
|
|
|
|
2020-11-01 07:58:20 +00:00
|
|
|
if (controls.BACK)
|
|
|
|
{
|
|
|
|
FlxG.sound.music.stop();
|
|
|
|
|
|
|
|
if (PlayState.isStoryMode)
|
|
|
|
FlxG.switchState(new StoryMenuState());
|
|
|
|
else
|
|
|
|
FlxG.switchState(new FreeplayState());
|
|
|
|
}
|
|
|
|
|
2020-10-27 10:35:23 +00:00
|
|
|
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);
|
|
|
|
}
|
2020-10-28 09:26:33 +00:00
|
|
|
|
|
|
|
if (FlxG.sound.music.playing)
|
|
|
|
{
|
|
|
|
Conductor.songPosition = FlxG.sound.music.time;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
override function beatHit()
|
|
|
|
{
|
|
|
|
super.beatHit();
|
|
|
|
|
|
|
|
FlxG.log.add('beat');
|
2020-10-27 10:35:23 +00:00
|
|
|
}
|
2020-10-28 07:03:32 +00:00
|
|
|
|
|
|
|
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());
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
2020-10-27 10:35:23 +00:00
|
|
|
}
|