Funkin/source/GameOverSubstate.hx

48 lines
1.0 KiB
Haxe
Raw Normal View History

2020-10-27 10:35:23 +00:00
package;
import flixel.FlxG;
import flixel.FlxObject;
import flixel.FlxSubState;
import flixel.math.FlxPoint;
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 (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);
}
}
}