1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-10 00:34:40 +00:00
Funkin/source/GameOverSubstate.hx
2020-10-27 03:35:23 -07:00

48 lines
1 KiB
Haxe

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);
}
}
}