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