2023-08-08 20:41:23 +00:00
|
|
|
package funkin.ui.title;
|
2020-10-05 18:24:51 +00:00
|
|
|
|
|
|
|
import flixel.FlxSprite;
|
2021-09-07 21:09:34 +00:00
|
|
|
import flixel.FlxState;
|
2020-10-21 06:23:39 +00:00
|
|
|
import flixel.group.FlxGroup;
|
2020-10-09 07:29:00 +00:00
|
|
|
import flixel.input.gamepad.FlxGamepad;
|
2020-10-05 18:24:51 +00:00
|
|
|
import flixel.tweens.FlxEase;
|
|
|
|
import flixel.tweens.FlxTween;
|
|
|
|
import flixel.util.FlxColor;
|
2022-07-22 20:11:18 +00:00
|
|
|
import flixel.util.FlxDirectionFlags;
|
2020-10-05 18:24:51 +00:00
|
|
|
import flixel.util.FlxTimer;
|
2023-11-07 09:04:22 +00:00
|
|
|
import funkin.audio.visualize.SpectogramSprite;
|
|
|
|
import funkin.graphics.shaders.ColorSwap;
|
|
|
|
import funkin.graphics.shaders.LeftMaskShader;
|
2023-09-08 21:46:44 +00:00
|
|
|
import funkin.data.song.SongRegistry;
|
2024-01-16 21:49:15 +00:00
|
|
|
import funkin.graphics.FunkinSprite;
|
2023-11-07 09:04:22 +00:00
|
|
|
import funkin.ui.MusicBeatState;
|
2023-09-08 21:46:44 +00:00
|
|
|
import funkin.data.song.SongData.SongMusicData;
|
2023-11-07 09:04:22 +00:00
|
|
|
import funkin.graphics.shaders.TitleOutline;
|
|
|
|
import funkin.ui.freeplay.FreeplayState;
|
2022-04-18 23:36:09 +00:00
|
|
|
import funkin.ui.AtlasText;
|
2021-01-25 03:42:51 +00:00
|
|
|
import openfl.Assets;
|
2021-04-09 23:17:14 +00:00
|
|
|
import openfl.display.Sprite;
|
|
|
|
import openfl.events.AsyncErrorEvent;
|
2023-11-07 09:04:22 +00:00
|
|
|
import funkin.ui.mainmenu.MainMenuState;
|
2021-04-09 23:17:14 +00:00
|
|
|
import openfl.events.MouseEvent;
|
|
|
|
import openfl.events.NetStatusEvent;
|
2023-11-07 09:04:22 +00:00
|
|
|
import funkin.ui.freeplay.FreeplayState;
|
2021-04-09 23:17:14 +00:00
|
|
|
import openfl.media.Video;
|
|
|
|
import openfl.net.NetStream;
|
2023-11-07 09:04:22 +00:00
|
|
|
import funkin.api.newgrounds.NGio;
|
2023-08-28 18:52:03 +00:00
|
|
|
import openfl.display.BlendMode;
|
2020-10-05 18:24:51 +00:00
|
|
|
|
2021-03-22 14:09:46 +00:00
|
|
|
#if desktop
|
2021-03-20 18:55:29 +00:00
|
|
|
#end
|
2020-10-21 06:23:39 +00:00
|
|
|
class TitleState extends MusicBeatState
|
2020-10-05 18:24:51 +00:00
|
|
|
{
|
2023-08-08 20:41:23 +00:00
|
|
|
/**
|
|
|
|
* Only play the credits once per session.
|
|
|
|
*/
|
2023-01-23 03:25:45 +00:00
|
|
|
public static var initialized:Bool = false;
|
2020-10-05 18:24:51 +00:00
|
|
|
|
2023-01-23 03:25:45 +00:00
|
|
|
var blackScreen:FlxSprite;
|
|
|
|
var credGroup:FlxGroup;
|
|
|
|
var textGroup:FlxGroup;
|
|
|
|
var ngSpr:FlxSprite;
|
2020-11-01 01:11:14 +00:00
|
|
|
|
2023-01-23 03:25:45 +00:00
|
|
|
var curWacky:Array<String> = [];
|
|
|
|
var lastBeat:Int = 0;
|
|
|
|
var swagShader:ColorSwap;
|
2021-04-05 20:42:04 +00:00
|
|
|
|
2023-01-23 03:25:45 +00:00
|
|
|
var video:Video;
|
|
|
|
var netStream:NetStream;
|
|
|
|
var overlay:Sprite;
|
2021-04-09 23:17:14 +00:00
|
|
|
|
2023-01-23 03:25:45 +00:00
|
|
|
override public function create():Void
|
|
|
|
{
|
2023-06-27 00:39:47 +00:00
|
|
|
super.create();
|
2023-01-23 03:25:45 +00:00
|
|
|
swagShader = new ColorSwap();
|
2021-03-20 19:20:00 +00:00
|
|
|
|
2023-01-23 03:25:45 +00:00
|
|
|
curWacky = FlxG.random.getObject(getIntroTextShit());
|
2023-07-23 00:16:43 +00:00
|
|
|
FlxG.sound.cache(Paths.music('freakyMenu/freakyMenu'));
|
2020-11-01 01:11:14 +00:00
|
|
|
|
2023-01-23 03:25:45 +00:00
|
|
|
// DEBUG BULLSHIT
|
2020-10-30 23:47:19 +00:00
|
|
|
|
2023-01-23 03:25:45 +00:00
|
|
|
// netConnection.addEventListener(MouseEvent.MOUSE_DOWN, overlay_onMouseDown);
|
2023-06-06 21:38:31 +00:00
|
|
|
new FlxTimer().start(1, function(tmr:FlxTimer) {
|
2023-01-23 03:25:45 +00:00
|
|
|
startIntro();
|
|
|
|
});
|
|
|
|
}
|
2020-10-30 23:47:19 +00:00
|
|
|
|
2023-01-23 03:25:45 +00:00
|
|
|
function client_onMetaData(metaData:Dynamic)
|
|
|
|
{
|
|
|
|
video.attachNetStream(netStream);
|
2021-04-09 23:17:14 +00:00
|
|
|
|
2023-01-23 03:25:45 +00:00
|
|
|
video.width = video.videoWidth;
|
|
|
|
video.height = video.videoHeight;
|
|
|
|
// video.
|
|
|
|
}
|
2021-04-09 23:17:14 +00:00
|
|
|
|
2023-01-23 03:25:45 +00:00
|
|
|
function netStream_onAsyncError(event:AsyncErrorEvent):Void
|
|
|
|
{
|
|
|
|
trace("Error loading video");
|
|
|
|
}
|
2021-04-09 23:17:14 +00:00
|
|
|
|
2023-01-23 03:25:45 +00:00
|
|
|
function netConnection_onNetStatus(event:NetStatusEvent):Void
|
|
|
|
{
|
|
|
|
if (event.info.code == 'NetStream.Play.Complete')
|
|
|
|
{
|
|
|
|
// netStream.dispose();
|
|
|
|
// FlxG.stage.removeChild(video);
|
2021-04-09 23:17:14 +00:00
|
|
|
|
2023-01-23 03:25:45 +00:00
|
|
|
startIntro();
|
|
|
|
}
|
2021-04-09 23:17:14 +00:00
|
|
|
|
2023-01-23 03:25:45 +00:00
|
|
|
trace(event.toString());
|
|
|
|
}
|
|
|
|
|
|
|
|
function overlay_onMouseDown(event:MouseEvent):Void
|
|
|
|
{
|
|
|
|
netStream.soundTransform.volume = 0.2;
|
|
|
|
netStream.soundTransform.pan = -1;
|
|
|
|
// netStream.play(Paths.file('music/kickstarterTrailer.mp4'));
|
|
|
|
|
|
|
|
FlxG.stage.removeChild(overlay);
|
|
|
|
}
|
2021-04-09 23:17:14 +00:00
|
|
|
|
2023-01-23 03:25:45 +00:00
|
|
|
var logoBl:FlxSprite;
|
|
|
|
var outlineShaderShit:TitleOutline;
|
2021-04-09 23:17:14 +00:00
|
|
|
|
2023-08-28 18:52:03 +00:00
|
|
|
var gfDance:FlxSpriteOverlay;
|
2023-01-23 03:25:45 +00:00
|
|
|
var danceLeft:Bool = false;
|
|
|
|
var titleText:FlxSprite;
|
|
|
|
var maskShader = new LeftMaskShader();
|
2020-11-01 19:16:22 +00:00
|
|
|
|
2023-01-23 03:25:45 +00:00
|
|
|
function startIntro()
|
|
|
|
{
|
2023-07-02 19:34:34 +00:00
|
|
|
playMenuMusic();
|
2020-10-05 18:24:51 +00:00
|
|
|
|
2023-01-23 03:25:45 +00:00
|
|
|
persistentUpdate = true;
|
|
|
|
|
2024-01-16 21:49:15 +00:00
|
|
|
var bg:FunkinSprite = new FunkinSprite().makeSolidColor(FlxG.width, FlxG.height, FlxColor.BLACK);
|
|
|
|
bg.screenCenter();
|
2023-01-23 03:25:45 +00:00
|
|
|
add(bg);
|
|
|
|
|
|
|
|
logoBl = new FlxSprite(-150, -100);
|
|
|
|
logoBl.frames = Paths.getSparrowAtlas('logoBumpin');
|
|
|
|
logoBl.animation.addByPrefix('bump', 'logo bumpin', 24);
|
|
|
|
logoBl.animation.play('bump');
|
|
|
|
|
|
|
|
logoBl.updateHitbox();
|
|
|
|
|
|
|
|
outlineShaderShit = new TitleOutline();
|
|
|
|
|
2023-08-28 18:52:03 +00:00
|
|
|
gfDance = new FlxSpriteOverlay(FlxG.width * 0.4, FlxG.height * 0.07);
|
2023-01-23 03:25:45 +00:00
|
|
|
gfDance.frames = Paths.getSparrowAtlas('gfDanceTitle');
|
|
|
|
gfDance.animation.addByIndices('danceLeft', 'gfDance', [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false);
|
|
|
|
gfDance.animation.addByIndices('danceRight', 'gfDance', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "", 24, false);
|
|
|
|
|
|
|
|
// maskShader.swagSprX = gfDance.x;
|
|
|
|
// maskShader.swagMaskX = gfDance.x + 200;
|
|
|
|
// maskShader.frameUV = gfDance.frame.uv;
|
|
|
|
// gfDance.shader = maskShader;
|
|
|
|
|
|
|
|
// gfDance.shader = swagShader.shader;
|
|
|
|
|
|
|
|
// gfDance.shader = new TitleOutline();
|
|
|
|
|
|
|
|
add(logoBl);
|
|
|
|
|
2023-08-28 18:52:03 +00:00
|
|
|
add(gfDance);
|
|
|
|
|
2023-01-23 03:25:45 +00:00
|
|
|
titleText = new FlxSprite(100, FlxG.height * 0.8);
|
|
|
|
titleText.frames = Paths.getSparrowAtlas('titleEnter');
|
|
|
|
titleText.animation.addByPrefix('idle', "Press Enter to Begin", 24);
|
|
|
|
titleText.animation.addByPrefix('press', "ENTER PRESSED", 24);
|
|
|
|
titleText.animation.play('idle');
|
|
|
|
titleText.updateHitbox();
|
|
|
|
// titleText.screenCenter(X);
|
|
|
|
add(titleText);
|
|
|
|
|
2023-08-08 20:41:23 +00:00
|
|
|
if (!initialized) // Fix an issue where returning to the credits would play a black screen.
|
|
|
|
{
|
|
|
|
credGroup = new FlxGroup();
|
|
|
|
add(credGroup);
|
|
|
|
}
|
2023-01-23 03:25:45 +00:00
|
|
|
|
|
|
|
textGroup = new FlxGroup();
|
|
|
|
|
|
|
|
blackScreen = bg.clone();
|
2023-08-08 20:41:23 +00:00
|
|
|
if (credGroup != null)
|
|
|
|
{
|
|
|
|
credGroup.add(blackScreen);
|
|
|
|
credGroup.add(textGroup);
|
|
|
|
}
|
2023-01-23 03:25:45 +00:00
|
|
|
|
|
|
|
ngSpr = new FlxSprite(0, FlxG.height * 0.52);
|
|
|
|
|
|
|
|
if (FlxG.random.bool(1))
|
|
|
|
{
|
|
|
|
ngSpr.loadGraphic(Paths.image('newgrounds_logo_classic'));
|
|
|
|
}
|
|
|
|
else if (FlxG.random.bool(30))
|
|
|
|
{
|
|
|
|
ngSpr.loadGraphic(Paths.image('newgrounds_logo_animated'), true, 600);
|
|
|
|
ngSpr.animation.add('idle', [0, 1], 4);
|
|
|
|
ngSpr.animation.play('idle');
|
|
|
|
ngSpr.setGraphicSize(Std.int(ngSpr.width * 0.55));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ngSpr.loadGraphic(Paths.image('newgrounds_logo'));
|
|
|
|
ngSpr.setGraphicSize(Std.int(ngSpr.width * 0.8));
|
|
|
|
}
|
|
|
|
|
|
|
|
add(ngSpr);
|
|
|
|
ngSpr.visible = false;
|
|
|
|
|
|
|
|
ngSpr.updateHitbox();
|
|
|
|
ngSpr.screenCenter(X);
|
|
|
|
|
|
|
|
FlxG.mouse.visible = false;
|
|
|
|
|
|
|
|
if (initialized) skipIntro();
|
|
|
|
else
|
|
|
|
initialized = true;
|
|
|
|
|
2023-08-08 19:41:48 +00:00
|
|
|
if (FlxG.sound.music != null) FlxG.sound.music.onComplete = moveToAttract;
|
2023-01-23 03:25:45 +00:00
|
|
|
}
|
|
|
|
|
2023-08-08 19:41:48 +00:00
|
|
|
/**
|
|
|
|
* After sitting on the title screen for a while, transition to the attract screen.
|
|
|
|
*/
|
2023-08-08 20:41:23 +00:00
|
|
|
function moveToAttract():Void
|
|
|
|
{
|
|
|
|
FlxG.switchState(new AttractState());
|
|
|
|
}
|
2023-08-08 19:41:48 +00:00
|
|
|
|
2023-07-02 19:34:34 +00:00
|
|
|
function playMenuMusic():Void
|
|
|
|
{
|
|
|
|
if (FlxG.sound.music == null || !FlxG.sound.music.playing)
|
|
|
|
{
|
2023-09-08 21:46:44 +00:00
|
|
|
var freakyMenuMetadata:Null<SongMusicData> = SongRegistry.instance.parseMusicData('freakyMenu');
|
|
|
|
if (freakyMenuMetadata != null)
|
|
|
|
{
|
2023-12-14 21:56:20 +00:00
|
|
|
Conductor.instance.mapTimeChanges(freakyMenuMetadata.timeChanges);
|
2023-09-08 21:46:44 +00:00
|
|
|
}
|
2023-07-02 19:34:34 +00:00
|
|
|
FlxG.sound.playMusic(Paths.music('freakyMenu/freakyMenu'), 0);
|
|
|
|
FlxG.sound.music.fadeIn(4, 0, 0.7);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-01-23 03:25:45 +00:00
|
|
|
function getIntroTextShit():Array<Array<String>>
|
|
|
|
{
|
|
|
|
var fullText:String = Assets.getText(Paths.txt('introText'));
|
|
|
|
|
2023-11-20 15:42:23 +00:00
|
|
|
// Split into lines and remove empty lines
|
|
|
|
var firstArray:Array<String> = fullText.split('\n').filter(function(s:String) return s != '');
|
2023-01-23 03:25:45 +00:00
|
|
|
var swagGoodArray:Array<Array<String>> = [];
|
|
|
|
|
|
|
|
for (i in firstArray)
|
|
|
|
{
|
|
|
|
swagGoodArray.push(i.split('--'));
|
|
|
|
}
|
|
|
|
|
|
|
|
return swagGoodArray;
|
|
|
|
}
|
|
|
|
|
|
|
|
var transitioning:Bool = false;
|
|
|
|
|
|
|
|
override function update(elapsed:Float)
|
|
|
|
{
|
2023-08-28 18:52:03 +00:00
|
|
|
FlxG.bitmapLog.add(FlxG.camera.buffer);
|
|
|
|
|
2023-01-23 03:25:45 +00:00
|
|
|
#if HAS_PITCH
|
|
|
|
if (FlxG.keys.pressed.UP) FlxG.sound.music.pitch += 0.5 * elapsed;
|
|
|
|
|
|
|
|
if (FlxG.keys.pressed.DOWN) FlxG.sound.music.pitch -= 0.5 * elapsed;
|
|
|
|
#end
|
|
|
|
|
2023-12-14 21:56:20 +00:00
|
|
|
Conductor.instance.update();
|
2023-01-23 03:25:45 +00:00
|
|
|
|
|
|
|
/* if (FlxG.onMobile)
|
|
|
|
{
|
|
|
|
if (gfDance != null)
|
|
|
|
{
|
|
|
|
gfDance.x = (FlxG.width / 2) + (FlxG.accelerometer.x * (FlxG.width / 2));
|
|
|
|
// gfDance.y = (FlxG.height / 2) + (FlxG.accelerometer.y * (FlxG.height / 2));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
if (FlxG.keys.justPressed.I)
|
|
|
|
{
|
|
|
|
FlxTween.tween(outlineShaderShit, {funnyX: 50, funnyY: 50}, 0.6, {ease: FlxEase.quartOut});
|
|
|
|
}
|
|
|
|
if (FlxG.keys.pressed.D) outlineShaderShit.funnyX += 1;
|
|
|
|
// outlineShaderShit.xPos.value[0] += 1;
|
|
|
|
|
|
|
|
if (FlxG.keys.justPressed.Y)
|
|
|
|
{
|
|
|
|
FlxTween.tween(FlxG.stage.window, {x: FlxG.stage.window.x + 300}, 1.4, {ease: FlxEase.quadInOut, type: PINGPONG, startDelay: 0.35});
|
|
|
|
FlxTween.tween(FlxG.stage.window, {y: FlxG.stage.window.y + 100}, 0.7, {ease: FlxEase.quadInOut, type: PINGPONG});
|
|
|
|
}
|
|
|
|
|
2023-12-14 21:56:20 +00:00
|
|
|
if (FlxG.sound.music != null) Conductor.instance.update(FlxG.sound.music.time);
|
2023-01-23 03:25:45 +00:00
|
|
|
if (FlxG.keys.justPressed.F) FlxG.fullscreen = !FlxG.fullscreen;
|
|
|
|
|
|
|
|
// do controls.PAUSE | controls.ACCEPT instead?
|
|
|
|
var pressedEnter:Bool = FlxG.keys.justPressed.ENTER;
|
|
|
|
|
|
|
|
if (FlxG.onMobile)
|
|
|
|
{
|
|
|
|
for (touch in FlxG.touches.list)
|
|
|
|
{
|
|
|
|
if (touch.justPressed)
|
|
|
|
{
|
|
|
|
FlxG.switchState(new FreeplayState());
|
|
|
|
pressedEnter = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var gamepad:FlxGamepad = FlxG.gamepads.lastActive;
|
|
|
|
|
|
|
|
if (gamepad != null)
|
|
|
|
{
|
|
|
|
if (gamepad.justPressed.START) pressedEnter = true;
|
|
|
|
#if switch
|
|
|
|
if (gamepad.justPressed.B) pressedEnter = true;
|
|
|
|
#end
|
|
|
|
}
|
|
|
|
|
2023-08-08 20:41:23 +00:00
|
|
|
// If you spam Enter, we should skip the transition.
|
2023-01-23 03:25:45 +00:00
|
|
|
if (pressedEnter && transitioning && skippedIntro)
|
|
|
|
{
|
|
|
|
FlxG.switchState(new MainMenuState());
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pressedEnter && !transitioning && skippedIntro)
|
|
|
|
{
|
|
|
|
if (FlxG.sound.music != null) FlxG.sound.music.onComplete = null;
|
|
|
|
// netStream.play(Paths.file('music/kickstarterTrailer.mp4'));
|
|
|
|
NGio.unlockMedal(60960);
|
|
|
|
// If it's Friday according to da clock
|
|
|
|
if (Date.now().getDay() == 5) NGio.unlockMedal(61034);
|
|
|
|
titleText.animation.play('press');
|
|
|
|
FlxG.camera.flash(FlxColor.WHITE, 1);
|
|
|
|
FlxG.sound.play(Paths.sound('confirmMenu'), 0.7);
|
|
|
|
transitioning = true;
|
|
|
|
|
|
|
|
var targetState:FlxState = new MainMenuState();
|
|
|
|
|
2023-06-06 21:38:31 +00:00
|
|
|
new FlxTimer().start(2, function(tmr:FlxTimer) {
|
2023-01-23 03:25:45 +00:00
|
|
|
// 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???
|
2023-08-08 19:41:25 +00:00
|
|
|
// TODO: This BREAKS the title screen if you return back to it! Figure out how to fix that.
|
|
|
|
// Assets.cache.clear(Paths.image('gfDanceTitle'));
|
|
|
|
// Assets.cache.clear(Paths.image('logoBumpin'));
|
|
|
|
// Assets.cache.clear(Paths.image('titleEnter'));
|
2023-01-23 03:25:45 +00:00
|
|
|
// ngSpr??
|
|
|
|
FlxG.switchState(targetState);
|
|
|
|
});
|
|
|
|
// FlxG.sound.play(Paths.music('titleShoot'), 0.7);
|
|
|
|
}
|
|
|
|
if (pressedEnter && !skippedIntro && initialized) skipIntro();
|
|
|
|
|
|
|
|
if (controls.UI_LEFT) swagShader.update(-elapsed * 0.1);
|
|
|
|
if (controls.UI_RIGHT) swagShader.update(elapsed * 0.1);
|
|
|
|
if (!cheatActive && skippedIntro) cheatCodeShit();
|
|
|
|
super.update(elapsed);
|
|
|
|
}
|
|
|
|
|
|
|
|
override function draw()
|
|
|
|
{
|
|
|
|
super.draw();
|
|
|
|
}
|
|
|
|
|
|
|
|
var cheatArray:Array<Int> = [0x0001, 0x0010, 0x0001, 0x0010, 0x0100, 0x1000, 0x0100, 0x1000];
|
|
|
|
var curCheatPos:Int = 0;
|
|
|
|
var cheatActive:Bool = false;
|
|
|
|
|
|
|
|
function cheatCodeShit():Void
|
|
|
|
{
|
|
|
|
if (FlxG.keys.justPressed.ANY)
|
|
|
|
{
|
|
|
|
if (controls.NOTE_DOWN_P || controls.UI_DOWN_P) codePress(FlxDirectionFlags.DOWN);
|
|
|
|
if (controls.NOTE_UP_P || controls.UI_UP_P) codePress(FlxDirectionFlags.UP);
|
|
|
|
if (controls.NOTE_LEFT_P || controls.UI_LEFT_P) codePress(FlxDirectionFlags.LEFT);
|
|
|
|
if (controls.NOTE_RIGHT_P || controls.UI_RIGHT_P) codePress(FlxDirectionFlags.RIGHT);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function codePress(input:Int)
|
|
|
|
{
|
|
|
|
if (input == cheatArray[curCheatPos])
|
|
|
|
{
|
|
|
|
curCheatPos += 1;
|
|
|
|
if (curCheatPos >= cheatArray.length) startCheat();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
curCheatPos = 0;
|
|
|
|
|
|
|
|
trace(input);
|
|
|
|
}
|
|
|
|
|
|
|
|
function startCheat():Void
|
|
|
|
{
|
|
|
|
cheatActive = true;
|
|
|
|
|
|
|
|
FlxG.sound.playMusic(Paths.music('tutorialTitle'), 1);
|
|
|
|
|
|
|
|
var spec:SpectogramSprite = new SpectogramSprite(FlxG.sound.music);
|
|
|
|
add(spec);
|
|
|
|
|
2023-12-14 21:56:20 +00:00
|
|
|
Conductor.instance.forceBPM(190);
|
2023-01-23 03:25:45 +00:00
|
|
|
FlxG.camera.flash(FlxColor.WHITE, 1);
|
|
|
|
FlxG.sound.play(Paths.sound('confirmMenu'), 0.7);
|
|
|
|
}
|
|
|
|
|
|
|
|
function createCoolText(textArray:Array<String>)
|
|
|
|
{
|
|
|
|
if (credGroup == null || textGroup == null) return;
|
|
|
|
|
|
|
|
for (i in 0...textArray.length)
|
|
|
|
{
|
|
|
|
var money:AtlasText = new AtlasText(0, 0, textArray[i], AtlasFont.BOLD);
|
|
|
|
money.screenCenter(X);
|
|
|
|
money.y += (i * 60) + 200;
|
|
|
|
// credGroup.add(money);
|
|
|
|
textGroup.add(money);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function addMoreText(text:String)
|
|
|
|
{
|
|
|
|
if (credGroup == null || textGroup == null) return;
|
|
|
|
|
|
|
|
lime.ui.Haptic.vibrate(100, 100);
|
|
|
|
|
|
|
|
var coolText:AtlasText = new AtlasText(0, 0, text.trim(), AtlasFont.BOLD);
|
|
|
|
coolText.screenCenter(X);
|
|
|
|
coolText.y += (textGroup.length * 60) + 200;
|
|
|
|
textGroup.add(coolText);
|
|
|
|
}
|
|
|
|
|
|
|
|
function deleteCoolText()
|
|
|
|
{
|
|
|
|
if (credGroup == null || textGroup == null) return;
|
|
|
|
|
|
|
|
while (textGroup.members.length > 0)
|
|
|
|
{
|
|
|
|
// credGroup.remove(textGroup.members[0], true);
|
|
|
|
textGroup.remove(textGroup.members[0], true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var isRainbow:Bool = false;
|
|
|
|
var skippedIntro:Bool = false;
|
|
|
|
|
|
|
|
override function beatHit():Bool
|
|
|
|
{
|
|
|
|
// super.beatHit() returns false if a module cancelled the event.
|
|
|
|
if (!super.beatHit()) return false;
|
|
|
|
|
|
|
|
if (!skippedIntro)
|
|
|
|
{
|
2023-12-14 21:56:20 +00:00
|
|
|
// FlxG.log.add(Conductor.instance.currentBeat);
|
2023-01-23 03:25:45 +00:00
|
|
|
// if the user is draggin the window some beats will
|
|
|
|
// be missed so this is just to compensate
|
2023-12-14 21:56:20 +00:00
|
|
|
if (Conductor.instance.currentBeat > lastBeat)
|
2023-01-23 03:25:45 +00:00
|
|
|
{
|
|
|
|
// TODO: Why does it perform ALL the previous steps each beat?
|
2023-12-14 21:56:20 +00:00
|
|
|
for (i in lastBeat...Conductor.instance.currentBeat)
|
2023-01-23 03:25:45 +00:00
|
|
|
{
|
|
|
|
switch (i + 1)
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
createCoolText(['ninjamuffin99', 'phantomArcade', 'kawaisprite', 'evilsk8r']);
|
|
|
|
case 3:
|
|
|
|
addMoreText('present');
|
|
|
|
case 4:
|
|
|
|
deleteCoolText();
|
|
|
|
case 5:
|
|
|
|
createCoolText(['In association', 'with']);
|
|
|
|
case 7:
|
|
|
|
addMoreText('newgrounds');
|
|
|
|
if (ngSpr != null) ngSpr.visible = true;
|
|
|
|
case 8:
|
|
|
|
deleteCoolText();
|
|
|
|
if (ngSpr != null) ngSpr.visible = false;
|
|
|
|
case 9:
|
|
|
|
createCoolText([curWacky[0]]);
|
|
|
|
case 11:
|
|
|
|
addMoreText(curWacky[1]);
|
|
|
|
case 12:
|
|
|
|
deleteCoolText();
|
|
|
|
case 13:
|
|
|
|
addMoreText('Friday');
|
|
|
|
case 14:
|
|
|
|
addMoreText('Night');
|
|
|
|
case 15:
|
|
|
|
addMoreText('Funkin');
|
|
|
|
case 16:
|
|
|
|
skipIntro();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-12-14 21:56:20 +00:00
|
|
|
lastBeat = Conductor.instance.currentBeat;
|
2023-01-23 03:25:45 +00:00
|
|
|
}
|
|
|
|
if (skippedIntro)
|
|
|
|
{
|
2023-12-14 21:56:20 +00:00
|
|
|
if (cheatActive && Conductor.instance.currentBeat % 2 == 0) swagShader.update(0.125);
|
2023-01-23 03:25:45 +00:00
|
|
|
|
|
|
|
if (logoBl != null && logoBl.animation != null) logoBl.animation.play('bump', true);
|
|
|
|
|
|
|
|
danceLeft = !danceLeft;
|
|
|
|
|
|
|
|
if (gfDance != null && gfDance.animation != null)
|
|
|
|
{
|
|
|
|
if (danceLeft) gfDance.animation.play('danceRight');
|
|
|
|
else
|
|
|
|
gfDance.animation.play('danceLeft');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
function skipIntro():Void
|
|
|
|
{
|
|
|
|
if (!skippedIntro)
|
|
|
|
{
|
|
|
|
remove(ngSpr);
|
|
|
|
|
2023-08-08 20:41:23 +00:00
|
|
|
FlxG.camera.flash(FlxColor.WHITE, initialized ? 1 : 4);
|
2023-01-23 03:25:45 +00:00
|
|
|
remove(credGroup);
|
|
|
|
skippedIntro = true;
|
|
|
|
}
|
|
|
|
}
|
2020-10-05 18:24:51 +00:00
|
|
|
}
|