quick title screen optimize

This commit is contained in:
Cameron Taylor 2021-06-08 23:05:38 -04:00
parent 2db47b1ba9
commit 7ebc7e4ffb
2 changed files with 15 additions and 0 deletions

View file

@ -2732,6 +2732,14 @@ class PlayState extends MusicBeatState
}); });
} }
override function switchTo(nextState:FlxState):Bool
{
openfl.utils.Assets.cache.clear(Paths.inst(SONG.song));
openfl.utils.Assets.cache.clear(Paths.voices(SONG.song));
return super.switchTo(nextState);
}
function noteMiss(direction:Int = 1):Void function noteMiss(direction:Int = 1):Void
{ {
// whole function used to be encased in if (!boyfriend.stunned) // whole function used to be encased in if (!boyfriend.stunned)

View file

@ -465,6 +465,13 @@ class TitleState extends MusicBeatState
FlxG.sound.play(Paths.sound('confirmMenu'), 0.7); FlxG.sound.play(Paths.sound('confirmMenu'), 0.7);
transitioning = true; transitioning = true;
// FlxG.sound.music.stop(); // FlxG.sound.music.stop();
// These assets are very unlikely to be used for the rest of gameplay, so it unloads them from cache/memory
// Saves about 50mb of RAM or so???
Assets.cache.clear(Paths.image('gfDanceTitle'));
Assets.cache.clear(Paths.image('logoBumpin'));
Assets.cache.clear(Paths.image('titleEnter'));
#if newgrounds #if newgrounds
if (!OutdatedSubState.leftState) if (!OutdatedSubState.leftState)
{ {