mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2025-07-04 01:36:24 +00:00
Fix a bug where returning to title displays a black screen.
This commit is contained in:
parent
ea31d72cbe
commit
92e94a84b6
|
@ -1,4 +1,4 @@
|
||||||
package funkin;
|
package funkin.ui.title;
|
||||||
|
|
||||||
import flixel.FlxSprite;
|
import flixel.FlxSprite;
|
||||||
import flixel.FlxState;
|
import flixel.FlxState;
|
||||||
|
@ -28,6 +28,9 @@ import openfl.net.NetStream;
|
||||||
#end
|
#end
|
||||||
class TitleState extends MusicBeatState
|
class TitleState extends MusicBeatState
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Only play the credits once per session.
|
||||||
|
*/
|
||||||
public static var initialized:Bool = false;
|
public static var initialized:Bool = false;
|
||||||
|
|
||||||
var blackScreen:FlxSprite;
|
var blackScreen:FlxSprite;
|
||||||
|
@ -148,14 +151,20 @@ class TitleState extends MusicBeatState
|
||||||
// titleText.screenCenter(X);
|
// titleText.screenCenter(X);
|
||||||
add(titleText);
|
add(titleText);
|
||||||
|
|
||||||
credGroup = new FlxGroup();
|
if (!initialized) // Fix an issue where returning to the credits would play a black screen.
|
||||||
add(credGroup);
|
{
|
||||||
|
credGroup = new FlxGroup();
|
||||||
|
add(credGroup);
|
||||||
|
}
|
||||||
|
|
||||||
textGroup = new FlxGroup();
|
textGroup = new FlxGroup();
|
||||||
|
|
||||||
blackScreen = bg.clone();
|
blackScreen = bg.clone();
|
||||||
credGroup.add(blackScreen);
|
if (credGroup != null)
|
||||||
credGroup.add(textGroup);
|
{
|
||||||
|
credGroup.add(blackScreen);
|
||||||
|
credGroup.add(textGroup);
|
||||||
|
}
|
||||||
|
|
||||||
// var atlasBullShit:FlxSprite = new FlxSprite();
|
// var atlasBullShit:FlxSprite = new FlxSprite();
|
||||||
// atlasBullShit.frames = CoolUtil.fromAnimate(Paths.image('money'), Paths.file('images/money.json'));
|
// atlasBullShit.frames = CoolUtil.fromAnimate(Paths.image('money'), Paths.file('images/money.json'));
|
||||||
|
@ -198,7 +207,10 @@ class TitleState extends MusicBeatState
|
||||||
/**
|
/**
|
||||||
* After sitting on the title screen for a while, transition to the attract screen.
|
* After sitting on the title screen for a while, transition to the attract screen.
|
||||||
*/
|
*/
|
||||||
function moveToAttact():Void {}
|
function moveToAttract():Void
|
||||||
|
{
|
||||||
|
FlxG.switchState(new AttractState());
|
||||||
|
}
|
||||||
|
|
||||||
function playMenuMusic():Void
|
function playMenuMusic():Void
|
||||||
{
|
{
|
||||||
|
@ -289,7 +301,7 @@ class TitleState extends MusicBeatState
|
||||||
#end
|
#end
|
||||||
}
|
}
|
||||||
|
|
||||||
// a faster intro thing lol!
|
// If you spam Enter, we should skip the transition.
|
||||||
if (pressedEnter && transitioning && skippedIntro)
|
if (pressedEnter && transitioning && skippedIntro)
|
||||||
{
|
{
|
||||||
FlxG.switchState(new MainMenuState());
|
FlxG.switchState(new MainMenuState());
|
||||||
|
@ -491,7 +503,7 @@ class TitleState extends MusicBeatState
|
||||||
{
|
{
|
||||||
remove(ngSpr);
|
remove(ngSpr);
|
||||||
|
|
||||||
FlxG.camera.flash(FlxColor.WHITE, 4);
|
FlxG.camera.flash(FlxColor.WHITE, initialized ? 1 : 4);
|
||||||
remove(credGroup);
|
remove(credGroup);
|
||||||
skippedIntro = true;
|
skippedIntro = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue