From 374f03dae30a90051ac761c04ea45de80d865df2 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Thu, 1 Jun 2023 00:31:32 -0400 Subject: [PATCH] Fakeout death now uses HScript --- source/funkin/play/GameOverSubstate.hx | 44 +++++++++++--------------- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/source/funkin/play/GameOverSubstate.hx b/source/funkin/play/GameOverSubstate.hx index 93cc47b57..041831962 100644 --- a/source/funkin/play/GameOverSubstate.hx +++ b/source/funkin/play/GameOverSubstate.hx @@ -1,6 +1,5 @@ package funkin.play; -import funkin.graphics.adobeanimate.FlxAtlasSprite; import flixel.FlxG; import flixel.FlxObject; import flixel.FlxSprite; @@ -100,29 +99,6 @@ class GameOverSubstate extends MusicBeatSubstate add(boyfriend); boyfriend.resetCharacter(); - if (boyfriend.characterId == "bf" && animationSuffix == "" && FlxG.random.bool((1 / 4000) * 100)) - { - FlxG.sound.play(Paths.sound("fakeout_death")); - - var bfFake:FlxAtlasSprite = new FlxAtlasSprite(boyfriend.x - 440, boyfriend.y - 240, Paths.animateAtlas("characters/bfFakeOut", "shared"),); - add(bfFake); - bfFake.playAnimation(""); - bfFake.anim.onComplete = () -> { - bfFake.visible = false; - boyfriend.visible = true; - boyfriend.playAnimation('firstDeath', true, true); - // Play the "blue balled" sound. May play a variant if one has been assigned. - playBlueBalledSFX(); - }; - boyfriend.visible = false; - } - else - { - boyfriend.playAnimation('firstDeath', true, true); - // Play the "blue balled" sound. May play a variant if one has been assigned. - playBlueBalledSFX(); - } - // Assign a camera follow point to the boyfriend's position. cameraFollowPoint = new FlxObject(PlayState.instance.cameraFollowPoint.x, PlayState.instance.cameraFollowPoint.y, 1, 1); cameraFollowPoint.x = boyfriend.getGraphicMidpoint().x; @@ -144,10 +120,28 @@ class GameOverSubstate extends MusicBeatSubstate Conductor.songPosition = 0; } + var hasStartedAnimation:Bool = false; + override function update(elapsed:Float) { super.update(elapsed); + if (!hasStartedAnimation) + { + hasStartedAnimation = true; + + if (boyfriend.hasAnimation('fakeoutDeath') && (FlxG.random.bool((1 / 4000) * 100) || true)) + { + boyfriend.playAnimation('fakeoutDeath', true, true); + } + else + { + boyfriend.playAnimation('firstDeath', true, true); + // Play the "blue balled" sound. May play a variant if one has been assigned. + playBlueBalledSFX(); + } + } + // // Handle user inputs. // @@ -279,7 +273,7 @@ class GameOverSubstate extends MusicBeatSubstate * Play the sound effect that occurs when * boyfriend's testicles get utterly annihilated. */ - function playBlueBalledSFX() + public static function playBlueBalledSFX() { FlxG.sound.play(Paths.sound('fnf_loss_sfx' + blueBallSuffix)); }