Skip to content

Commit

Permalink
booyah..
Browse files Browse the repository at this point in the history
  • Loading branch information
Fyrid19 committed Feb 14, 2024
1 parent 14203fc commit 8742119
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 7 deletions.
Binary file modified assets/shared/music/gameOver.ogg
Binary file not shown.
Binary file modified assets/shared/music/gameOverEnd.ogg
Binary file not shown.
Binary file added assets/shared/music/starlight.ogg
Binary file not shown.
4 changes: 3 additions & 1 deletion source/FreeplayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class FreeplayState extends MusicBeatState
'nerfed'
];

public static var curDiff:String = '';
public static var curDiff:String = 'normal';
var diffSelected:Int = 0;
var songSelected:Bool = false;

Expand Down Expand Up @@ -351,6 +351,8 @@ class FreeplayState extends MusicBeatState
var shiftMult:Int = 1;
if(FlxG.keys.pressed.SHIFT) shiftMult = 3;

if(curDiff == null) curDiff = 'normal';

if(songs.length > 1)
{
if (leftP)
Expand Down
45 changes: 42 additions & 3 deletions source/GameOverSubstate.hx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package;
import flixel.FlxG;
import flixel.FlxObject;
import flixel.FlxSubState;
import flixel.FlxCamera;
import flixel.text.FlxText;
import flixel.math.FlxMath;
import flixel.math.FlxPoint;
Expand All @@ -14,16 +15,22 @@ import flixel.tweens.FlxTween;
class GameOverSubstate extends MusicBeatSubstate
{
public var boyfriend:Boyfriend;
public var dad:Character;
var camFollow:FlxPoint;
var camFollowPos:FlxObject;
var updateCamera:Bool = false;
var playingDeathSound:Bool = false;

public var camHUD:FlxCamera;
public var camGame:FlxCamera;

var gameOverText:FlxText;
var songStatText:FlxText;

var stageSuffix:String = "";

public var dadHealthColor:FlxColor;

public static var characterName:String = 'bf-dead';
public static var deathSoundName:String = 'fnf_loss_sfx';
public static var loopSoundName:String = 'gameOver';
Expand All @@ -46,10 +53,20 @@ class GameOverSubstate extends MusicBeatSubstate
super.create();
}

public function new(x:Float, y:Float, camX:Float, camY:Float)
public function new(x:Float, y:Float, camX:Float, camY:Float, dadName:String)
{
super();

camGame = new FlxCamera();
camHUD = new FlxCamera();
camGame.bgColor.alpha = 0;
camHUD.bgColor.alpha = 0;

FlxG.cameras.reset(camGame);
FlxG.cameras.add(camHUD);

FlxCamera.defaultCameras = [camGame];

PlayState.instance.setOnLuas('inGameOver', true);

Conductor.songPosition = 0;
Expand All @@ -59,6 +76,10 @@ class GameOverSubstate extends MusicBeatSubstate
boyfriend.y += boyfriend.positionArray[1];
add(boyfriend);

dad = new Character(0, 0, dadName);
dad.visible = false;
add(dad); // idk if we really need to add him but just incase

gameOverText = new FlxText(0, 25, FlxG.width, "GAME OVER", 72);
gameOverText.setFormat(Paths.font("vcr.ttf"), 72, FlxColor.WHITE, CENTER, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
gameOverText.screenCenter(X);
Expand All @@ -74,10 +95,15 @@ class GameOverSubstate extends MusicBeatSubstate
+ " | Misses: " + PlayState.songMisses2;
add(songStatText);

dadHealthColor = FlxColor.fromRGB(dad.healthColorArray[0], dad.healthColorArray[1], dad.healthColorArray[2]);

gameOverText.cameras = [camHUD];
songStatText.cameras = [camHUD];

camFollow = new FlxPoint(boyfriend.getGraphicMidpoint().x, boyfriend.getGraphicMidpoint().y);

FlxG.sound.play(Paths.sound(deathSoundName));
Conductor.changeBPM(100);
Conductor.changeBPM(150);
// FlxG.camera.followLerp = 1;
// FlxG.camera.focusOn(FlxPoint.get(FlxG.width / 2, FlxG.height / 2));
FlxG.camera.scroll.set();
Expand Down Expand Up @@ -112,6 +138,9 @@ class GameOverSubstate extends MusicBeatSubstate
PlayState.deathCounter = 0;
PlayState.seenCutscene = false;

FlxTween.cancelTweensOf(gameOverText);
FlxTween.cancelTweensOf(songStatText);

WeekData.loadTheFirstEnabledMod();
if (PlayState.isStoryMode)
MusicBeatState.switchState(new StoryMenuState());
Expand All @@ -126,7 +155,7 @@ class GameOverSubstate extends MusicBeatSubstate
{
if(boyfriend.animation.curAnim.curFrame >= 12 && !isFollowingAlready)
{
FlxG.camera.follow(camFollowPos, LOCKON, 1);
FlxG.camera.follow(camFollowPos, LOCKON, 0.4);
updateCamera = true;
isFollowingAlready = true;
}
Expand Down Expand Up @@ -166,6 +195,12 @@ class GameOverSubstate extends MusicBeatSubstate
override function beatHit()
{
super.beatHit();
if (!isEnding) {
if (curBeat % 8 == 0) {
FlxTween.color(gameOverText, 0.8, dadHealthColor, FlxColor.WHITE);
FlxTween.color(songStatText, 0.8, dadHealthColor, FlxColor.WHITE);
}
}

//FlxG.log.add('beat');
}
Expand All @@ -191,6 +226,10 @@ class GameOverSubstate extends MusicBeatSubstate
{
isEnding = true;
boyfriend.playAnim('deathConfirm', true);
FlxTween.cancelTweensOf(gameOverText);
FlxTween.cancelTweensOf(songStatText);
FlxTween.tween(gameOverText, {alpha: 0}, 1, {ease: FlxEase.linear});
FlxTween.tween(songStatText, {alpha: 0}, 1, {ease: FlxEase.linear});
FlxG.sound.music.stop();
FlxG.sound.play(Paths.music(endSoundName));
new FlxTimer().start(0.7, function(tmr:FlxTimer)
Expand Down
2 changes: 1 addition & 1 deletion source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -3479,7 +3479,7 @@ for (key => value in luaShaders)
for (timer in modchartTimers) {
timer.active = true;
}
openSubState(new GameOverSubstate(boyfriend.getScreenPosition().x - boyfriend.positionArray[0], boyfriend.getScreenPosition().y - boyfriend.positionArray[1], camFollowPos.x, camFollowPos.y));
openSubState(new GameOverSubstate(boyfriend.getScreenPosition().x - boyfriend.positionArray[0], boyfriend.getScreenPosition().y - boyfriend.positionArray[1], camFollowPos.x, camFollowPos.y - 30, dad.curCharacter.toLowerCase()));

// MusicBeatState.switchState(new GameOverState(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y));

Expand Down
4 changes: 2 additions & 2 deletions source/options/VisualsUISubState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ class VisualsUISubState extends BaseOptionsMenu
"What song do you prefer for the Pause Screen?",
'pauseMusic',
'string',
'Tea Time',
['None', 'Breakfast', 'Tea Time']);
'Starlight',
['None', 'Starlight', 'Breakfast', 'Tea Time']);
addOption(option);
option.onChange = onChangePauseMusic;

Expand Down

0 comments on commit 8742119

Please sign in to comment.