diff --git a/source/Boyfriend.hx b/source/Boyfriend.hx index c9f87f9bf..3421367cb 100644 --- a/source/Boyfriend.hx +++ b/source/Boyfriend.hx @@ -16,6 +16,8 @@ class Boyfriend extends Character super(x, y, char, true); } + public var startedDeath:Bool = false; + override function update(elapsed:Float) { if (!debugMode) @@ -32,7 +34,7 @@ class Boyfriend extends Character playAnim('idle', true, false, 10); } - if (animation.curAnim.name == 'firstDeath' && animation.curAnim.finished) + if (animation.curAnim.name == 'firstDeath' && animation.curAnim.finished && startedDeath) { playAnim('deathLoop'); } diff --git a/source/GameOverSubstate.hx b/source/GameOverSubstate.hx index 1d672dbf4..79e86c748 100644 --- a/source/GameOverSubstate.hx +++ b/source/GameOverSubstate.hx @@ -13,6 +13,7 @@ class GameOverSubstate extends MusicBeatSubstate var camFollow:FlxObject; var stageSuffix:String = ""; + var randomGameover:Int = 1; public function new(x:Float, y:Float) { @@ -49,8 +50,12 @@ class GameOverSubstate extends MusicBeatSubstate FlxG.camera.target = null; bf.playAnim('firstDeath'); + + randomGameover = FlxG.random.int(1, 25); } + var playingDeathSound:Bool = false; + override function update(elapsed:Float) { super.update(elapsed); @@ -75,9 +80,24 @@ class GameOverSubstate extends MusicBeatSubstate FlxG.camera.follow(camFollow, LOCKON, 0.01); } - if (bf.animation.curAnim.name == 'firstDeath' && bf.animation.curAnim.finished) + switch (PlayState.storyWeek) { - FlxG.sound.playMusic(Paths.music('gameOver' + stageSuffix)); + case 7: + if (bf.animation.curAnim.name == 'firstDeath' && bf.animation.curAnim.finished && !playingDeathSound) + { + playingDeathSound = true; + FlxG.sound.play(Paths.sound('jeffGameover/jeffGameover-' + randomGameover), 1, false, null, true, function() + { + bf.startedDeath = true; + coolStartDeath(); + }); + } + default: + if (bf.animation.curAnim.name == 'firstDeath' && bf.animation.curAnim.finished) + { + bf.startedDeath = true; + coolStartDeath(); + } } if (FlxG.sound.music.playing) @@ -86,6 +106,11 @@ class GameOverSubstate extends MusicBeatSubstate } } + private function coolStartDeath():Void + { + FlxG.sound.playMusic(Paths.music('gameOver' + stageSuffix)); + } + override function beatHit() { super.beatHit();