1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-12-23 21:56:46 +00:00

song reset redo to make shit reload faster

This commit is contained in:
Cameron Taylor 2021-09-24 11:51:15 -04:00
parent 707c7b6f0a
commit c5bca599ad
4 changed files with 58 additions and 25 deletions

View file

@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- 3 AWESOME PICO VS. DARNELL SONGS!!
- Character offset editor / spritesheet viewer
## Changed
- Resetting from game over and "restart song" should be faster
- Health gain is different depending on how accurate you hit notes!
- slight less health gained on sustain notes
- The wave-y effect on Thorns for the school is now a shader, instead of a pre-baked animation!

View file

@ -3,6 +3,7 @@ package;
import flixel.FlxObject;
import flixel.FlxSubState;
import flixel.math.FlxPoint;
import flixel.system.FlxSound;
import flixel.util.FlxColor;
import flixel.util.FlxTimer;
import haxe.display.Display.Package;
@ -16,8 +17,13 @@ class GameOverSubstate extends MusicBeatSubstate
var stageSuffix:String = "";
var randomGameover:Int = 1;
var gameOverMusic:FlxSound;
public function new(x:Float, y:Float)
{
gameOverMusic = new FlxSound();
FlxG.sound.list.add(gameOverMusic);
var daStage = PlayState.curStage;
var daBf:String = '';
switch (daStage)
@ -48,7 +54,7 @@ class GameOverSubstate extends MusicBeatSubstate
add(camFollow);
FlxG.sound.play(Paths.sound('fnf_loss_sfx' + stageSuffix));
Conductor.changeBPM(100);
// Conductor.changeBPM(100);
switch (PlayState.SONG.player1)
{
@ -58,6 +64,8 @@ class GameOverSubstate extends MusicBeatSubstate
// FlxG.camera.followLerp = 1;
// FlxG.camera.focusOn(FlxPoint.get(FlxG.width / 2, FlxG.height / 2));
// commented out for now
FlxG.camera.scroll.set();
FlxG.camera.target = null;
@ -99,7 +107,8 @@ class GameOverSubstate extends MusicBeatSubstate
{
PlayState.deathCounter = 0;
PlayState.seenCutscene = false;
FlxG.sound.music.stop();
// FlxG.sound.music.stop();
gameOverMusic.stop();
if (PlayState.isStoryMode)
FlxG.switchState(new StoryMenuState());
@ -125,7 +134,10 @@ class GameOverSubstate extends MusicBeatSubstate
FlxG.sound.play(Paths.sound('jeffGameover/jeffGameover-' + randomGameover), 1, false, null, true, function()
{
if (!isEnding)
FlxG.sound.music.fadeIn(4, 0.2, 1);
{
gameOverMusic.fadeIn(4, 0.2, 1);
}
// FlxG.sound.music.fadeIn(4, 0.2, 1);
});
}
default:
@ -136,23 +148,21 @@ class GameOverSubstate extends MusicBeatSubstate
}
}
if (FlxG.sound.music.playing)
if (gameOverMusic.playing)
{
Conductor.songPosition = FlxG.sound.music.time;
Conductor.songPosition = gameOverMusic.time;
}
}
private function coolStartDeath(?vol:Float = 1):Void
{
if (!isEnding)
FlxG.sound.playMusic(Paths.music('gameOver' + stageSuffix), vol);
}
override function beatHit()
{
super.beatHit();
FlxG.log.add('beat');
{
gameOverMusic.loadEmbedded(Paths.music('gameOver' + stageSuffix));
gameOverMusic.volume = vol;
gameOverMusic.play();
}
// FlxG.sound.playMusic();
}
var isEnding:Bool = false;
@ -163,14 +173,17 @@ class GameOverSubstate extends MusicBeatSubstate
{
isEnding = true;
bf.playAnim('deathConfirm', true);
FlxG.sound.music.stop();
gameOverMusic.stop();
// FlxG.sound.music.stop();
FlxG.sound.play(Paths.music('gameOverEnd' + stageSuffix));
new FlxTimer().start(0.7, function(tmr:FlxTimer)
{
FlxG.camera.fade(FlxColor.BLACK, 2, false, function()
{
// close();
LoadingState.loadAndSwitchState(new PlayState());
FlxG.camera.fade(FlxColor.BLACK, 1, true, null, true);
PlayState.needsReset = true;
close();
// LoadingState.loadAndSwitchState(new PlayState());
});
});
}

View file

@ -174,7 +174,10 @@ class PauseSubState extends MusicBeatSubstate
menuItems = pauseOG;
regenMenu();
case "Restart Song":
FlxG.resetState();
PlayState.needsReset = true;
close();
// FlxG.resetState();
case "Exit to menu":
PlayState.seenCutscene = false;
PlayState.deathCounter = 0;

View file

@ -46,6 +46,7 @@ class PlayState extends MusicBeatState
public static var storyDifficulty:Int = 1;
public static var deathCounter:Int = 0;
public static var practiceMode:Bool = false;
public static var needsReset:Bool = false;
var halloweenLevel:Bool = false;
@ -708,10 +709,7 @@ class PlayState extends MusicBeatState
add(camFollow);
FlxG.camera.follow(camFollow, LOCKON, 0.04);
// FlxG.camera.setScrollBounds(0, FlxG.width, 0, FlxG.height);
FlxG.camera.zoom = defaultCamZoom;
FlxG.camera.focusOn(camFollow.getPosition());
resetCamFollow();
FlxG.worldBounds.set(0, 0, FlxG.width, FlxG.height);
@ -1831,11 +1829,19 @@ class PlayState extends MusicBeatState
#else
if (FlxG.keys.justPressed.H)
camHUD.visible = !camHUD.visible;
if (FlxG.keys.justPressed.K)
if (needsReset)
{
resetCamFollow();
paused = false;
persistentUpdate = true;
persistentDraw = true;
startingSong = true;
FlxG.sound.music.pause();
vocals.pause();
FlxG.sound.music.time = 0;
regenNoteData();
health = 1;
@ -1846,6 +1852,8 @@ class PlayState extends MusicBeatState
restartCountdownTimer();
needsReset = false;
// FlxScreenGrab.grab(null, true, true);
/*
@ -1978,7 +1986,7 @@ class PlayState extends MusicBeatState
var iconOffset:Int = 26;
iconP1.x = healthBar.x + (healthBar.width * (FlxMath.remapToRange(healthBar.value, 0, 2, 100, 0) * 0.01) - iconOffset);
iconP2.x = healthBar.x + (healthBar.width * (FlxMath.remapToRange(healthBar.percent, 0, 2, 100, 0) * 0.01)) - (iconP2.width - iconOffset);
iconP2.x = healthBar.x + (healthBar.width * (FlxMath.remapToRange(healthBar.value, 0, 2, 100, 0) * 0.01)) - (iconP2.width - iconOffset);
if (health > 2)
health = 2;
@ -2063,8 +2071,8 @@ class PlayState extends MusicBeatState
persistentDraw = false;
paused = true;
vocals.stop();
FlxG.sound.music.stop();
vocals.pause();
FlxG.sound.music.pause();
// unloadAssets();
@ -2903,6 +2911,14 @@ class PlayState extends MusicBeatState
}
}
function resetCamFollow():Void
{
FlxG.camera.follow(camFollow, LOCKON, 0.04);
// FlxG.camera.setScrollBounds(0, FlxG.width, 0, FlxG.height);
FlxG.camera.zoom = defaultCamZoom;
FlxG.camera.focusOn(camFollow.getPosition());
}
var fastCarCanDrive:Bool = true;
function resetFastCar():Void