TANKMAN GAMEOVER SHIT

This commit is contained in:
Cameron Taylor 2021-03-18 14:15:54 -04:00
parent 48411894e2
commit eefae64c0c
2 changed files with 30 additions and 3 deletions

View file

@ -16,6 +16,8 @@ class Boyfriend extends Character
super(x, y, char, true); super(x, y, char, true);
} }
public var startedDeath:Bool = false;
override function update(elapsed:Float) override function update(elapsed:Float)
{ {
if (!debugMode) if (!debugMode)
@ -32,7 +34,7 @@ class Boyfriend extends Character
playAnim('idle', true, false, 10); playAnim('idle', true, false, 10);
} }
if (animation.curAnim.name == 'firstDeath' && animation.curAnim.finished) if (animation.curAnim.name == 'firstDeath' && animation.curAnim.finished && startedDeath)
{ {
playAnim('deathLoop'); playAnim('deathLoop');
} }

View file

@ -13,6 +13,7 @@ class GameOverSubstate extends MusicBeatSubstate
var camFollow:FlxObject; var camFollow:FlxObject;
var stageSuffix:String = ""; var stageSuffix:String = "";
var randomGameover:Int = 1;
public function new(x:Float, y:Float) public function new(x:Float, y:Float)
{ {
@ -49,8 +50,12 @@ class GameOverSubstate extends MusicBeatSubstate
FlxG.camera.target = null; FlxG.camera.target = null;
bf.playAnim('firstDeath'); bf.playAnim('firstDeath');
randomGameover = FlxG.random.int(1, 25);
} }
var playingDeathSound:Bool = false;
override function update(elapsed:Float) override function update(elapsed:Float)
{ {
super.update(elapsed); super.update(elapsed);
@ -75,9 +80,24 @@ class GameOverSubstate extends MusicBeatSubstate
FlxG.camera.follow(camFollow, LOCKON, 0.01); FlxG.camera.follow(camFollow, LOCKON, 0.01);
} }
switch (PlayState.storyWeek)
{
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) if (bf.animation.curAnim.name == 'firstDeath' && bf.animation.curAnim.finished)
{ {
FlxG.sound.playMusic(Paths.music('gameOver' + stageSuffix)); bf.startedDeath = true;
coolStartDeath();
}
} }
if (FlxG.sound.music.playing) 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() override function beatHit()
{ {
super.beatHit(); super.beatHit();