mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-11-05 06:14:36 +00:00
fix crash when going back to title
This commit is contained in:
parent
d882d6568d
commit
c5d33192a4
|
@ -260,7 +260,10 @@ class MainMenuState extends MusicBeatState
|
|||
menuItems.enabled = false;
|
||||
|
||||
if (controls.BACK && menuItems.enabled && !menuItems.busy)
|
||||
{
|
||||
FlxG.sound.play(Paths.sound('cancelMenu'));
|
||||
FlxG.switchState(new TitleState());
|
||||
}
|
||||
|
||||
super.update(elapsed);
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ import sys.thread.Thread;
|
|||
class TitleState extends MusicBeatState
|
||||
{
|
||||
public static var initialized:Bool = false;
|
||||
var startedIntro:Bool;
|
||||
|
||||
var blackScreen:FlxSprite;
|
||||
var credGroup:FlxGroup;
|
||||
|
@ -73,6 +74,8 @@ class TitleState extends MusicBeatState
|
|||
// FlxG.bitmap.clearCache();
|
||||
#end
|
||||
|
||||
startedIntro = false;
|
||||
|
||||
FlxG.game.focusLostFramerate = 60;
|
||||
|
||||
swagShader = new ColorSwap();
|
||||
|
@ -222,20 +225,11 @@ class TitleState extends MusicBeatState
|
|||
new FlxRect(-200, -200, FlxG.width * 1.4, FlxG.height * 1.4));
|
||||
FlxTransitionableState.defaultTransOut = new TransitionData(FADE, FlxColor.BLACK, 0.7, new FlxPoint(0, 1),
|
||||
{asset: diamond, width: 32, height: 32}, new FlxRect(-200, -200, FlxG.width * 1.4, FlxG.height * 1.4));
|
||||
}
|
||||
|
||||
transIn = FlxTransitionableState.defaultTransIn;
|
||||
transOut = FlxTransitionableState.defaultTransOut;
|
||||
|
||||
// HAD TO MODIFY SOME BACKEND SHIT
|
||||
// IF THIS PR IS HERE IF ITS ACCEPTED UR GOOD TO GO
|
||||
// https://github.com/HaxeFlixel/flixel-addons/pull/348
|
||||
|
||||
// var music:FlxSound = new FlxSound();
|
||||
// music.loadStream(Paths.music('freakyMenu'));
|
||||
// FlxG.sound.list.add(music);
|
||||
// music.play();
|
||||
if (FlxG.sound.music == null || !FlxG.sound.music.playing)
|
||||
{
|
||||
FlxG.sound.playMusic(Paths.music('freakyMenu'), 0);
|
||||
|
||||
FlxG.sound.music.fadeIn(4, 0, 0.7);
|
||||
}
|
||||
|
||||
|
@ -331,6 +325,7 @@ class TitleState extends MusicBeatState
|
|||
if (FlxG.sound.music != null)
|
||||
FlxG.sound.music.onComplete = function() FlxG.switchState(new VideoState());
|
||||
|
||||
startedIntro = true;
|
||||
// credGroup.add(credTextShit);
|
||||
}
|
||||
|
||||
|
@ -353,8 +348,10 @@ class TitleState extends MusicBeatState
|
|||
|
||||
override function update(elapsed:Float)
|
||||
{
|
||||
#if debug
|
||||
if (FlxG.keys.justPressed.EIGHT)
|
||||
FlxG.switchState(new CutsceneAnimTestState());
|
||||
#end
|
||||
|
||||
/*
|
||||
if (FlxG.keys.justPressed.R)
|
||||
|
@ -372,9 +369,7 @@ class TitleState extends MusicBeatState
|
|||
// FlxG.watch.addQuick('amp', FlxG.sound.music.amplitude);
|
||||
|
||||
if (FlxG.keys.justPressed.F)
|
||||
{
|
||||
FlxG.fullscreen = !FlxG.fullscreen;
|
||||
}
|
||||
|
||||
var pressedEnter:Bool = FlxG.keys.justPressed.ENTER;
|
||||
|
||||
|
@ -382,17 +377,10 @@ class TitleState extends MusicBeatState
|
|||
for (touch in FlxG.touches.list)
|
||||
{
|
||||
if (touch.justPressed)
|
||||
{
|
||||
pressedEnter = true;
|
||||
}
|
||||
}
|
||||
#end
|
||||
|
||||
if (FlxG.keys.justPressed.FIVE)
|
||||
{
|
||||
FlxG.switchState(new CutsceneAnimTestState());
|
||||
}
|
||||
|
||||
var gamepad:FlxGamepad = FlxG.gamepads.lastActive;
|
||||
|
||||
if (gamepad != null)
|
||||
|
@ -456,9 +444,7 @@ class TitleState extends MusicBeatState
|
|||
}
|
||||
|
||||
if (pressedEnter && !skippedIntro && initialized)
|
||||
{
|
||||
skipIntro();
|
||||
}
|
||||
/*
|
||||
#if web
|
||||
if (!initialized && controls.ACCEPT)
|
||||
|
@ -476,16 +462,10 @@ class TitleState extends MusicBeatState
|
|||
// swagShader.hasOutline = !swagShader.hasOutline;
|
||||
|
||||
if (controls.UI_LEFT)
|
||||
{
|
||||
swagShader.update(-elapsed * 0.1);
|
||||
// alphaShader.update(-elapsed * 0.1);
|
||||
}
|
||||
|
||||
if (controls.UI_RIGHT)
|
||||
{
|
||||
swagShader.update(elapsed * 0.1);
|
||||
// alphaShader.update(elapsed * 0.1);
|
||||
}
|
||||
|
||||
super.update(elapsed);
|
||||
}
|
||||
|
@ -526,6 +506,11 @@ class TitleState extends MusicBeatState
|
|||
{
|
||||
super.beatHit();
|
||||
|
||||
if (!startedIntro)
|
||||
return ;
|
||||
|
||||
if (skippedIntro)
|
||||
{
|
||||
logoBl.animation.play('bump', true);
|
||||
|
||||
danceLeft = !danceLeft;
|
||||
|
@ -534,7 +519,9 @@ class TitleState extends MusicBeatState
|
|||
gfDance.animation.play('danceRight');
|
||||
else
|
||||
gfDance.animation.play('danceLeft');
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
FlxG.log.add(curBeat);
|
||||
// if the user is draggin the window some beats will
|
||||
// be missed so this is just to compensate
|
||||
|
@ -596,6 +583,7 @@ class TitleState extends MusicBeatState
|
|||
}
|
||||
lastBeat = curBeat;
|
||||
}
|
||||
}
|
||||
|
||||
var skippedIntro:Bool = false;
|
||||
|
||||
|
|
Loading…
Reference in a new issue