1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-12-29 00:08:11 +00:00
Funkin/source/funkin/TitleState.hx

619 lines
15 KiB
Haxe
Raw Normal View History

package funkin;
2020-10-05 18:24:51 +00:00
import flixel.FlxObject;
2020-10-05 18:24:51 +00:00
import flixel.FlxSprite;
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;
import flixel.util.FlxTimer;
import funkin.audiovis.SpectogramSprite;
import funkin.shaderslmfao.BuildingShaders;
import funkin.shaderslmfao.ColorSwap;
import funkin.shaderslmfao.TitleOutline;
2022-04-18 23:36:09 +00:00
import funkin.ui.AtlasText;
import funkin.util.Constants;
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;
import openfl.events.MouseEvent;
import openfl.events.NetStatusEvent;
import openfl.media.Video;
import openfl.net.NetStream;
2020-10-05 18:24:51 +00:00
using StringTools;
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
{
2021-04-18 08:09:56 +00:00
public static var initialized:Bool = false;
2020-10-05 18:24:51 +00:00
2020-10-21 06:23:39 +00:00
var blackScreen:FlxSprite;
var credGroup:FlxGroup;
2020-10-30 23:47:19 +00:00
var textGroup:FlxGroup;
2020-11-01 01:11:14 +00:00
var ngSpr:FlxSprite;
var curWacky:Array<String> = [];
var lastBeat:Int = 0;
2021-03-21 18:45:46 +00:00
var swagShader:ColorSwap;
2021-04-18 05:43:28 +00:00
var alphaShader:BuildingShaders;
2021-04-09 23:17:14 +00:00
var video:Video;
var netStream:NetStream;
private var overlay:Sprite;
2020-10-05 18:24:51 +00:00
override public function create():Void
{
2021-03-21 18:45:46 +00:00
swagShader = new ColorSwap();
2021-04-18 05:43:28 +00:00
alphaShader = new BuildingShaders();
2021-03-20 19:20:00 +00:00
2020-11-16 20:29:18 +00:00
curWacky = FlxG.random.getObject(getIntroTextShit());
2021-05-14 22:21:34 +00:00
FlxG.sound.cache(Paths.music('freakyMenu'));
2020-11-01 01:11:14 +00:00
2020-10-30 23:47:19 +00:00
// DEBUG BULLSHIT
2020-10-05 18:24:51 +00:00
super.create();
2021-04-10 06:53:23 +00:00
/*
2022-04-18 23:36:09 +00:00
#elseif web
2021-04-09 23:17:14 +00:00
2022-04-18 23:36:09 +00:00
if (!initialized)
{
2021-04-09 23:17:14 +00:00
2022-04-18 23:36:09 +00:00
video = new Video();
FlxG.stage.addChild(video);
2021-04-09 23:17:14 +00:00
2022-04-18 23:36:09 +00:00
var netConnection = new NetConnection();
netConnection.connect(null);
2021-04-10 06:53:23 +00:00
2022-04-18 23:36:09 +00:00
netStream = new NetStream(netConnection);
netStream.client = {onMetaData: client_onMetaData};
netStream.addEventListener(AsyncErrorEvent.ASYNC_ERROR, netStream_onAsyncError);
netConnection.addEventListener(NetStatusEvent.NET_STATUS, netConnection_onNetStatus);
// netStream.addEventListener(NetStatusEvent.NET_STATUS) // netStream.play(Paths.file('music/kickstarterTrailer.mp4'));
2021-04-10 06:53:23 +00:00
2022-04-18 23:36:09 +00:00
overlay = new Sprite();
overlay.graphics.beginFill(0, 0.5);
overlay.graphics.drawRect(0, 0, 1280, 720);
overlay.addEventListener(MouseEvent.MOUSE_DOWN, overlay_onMouseDown);
2021-04-10 06:53:23 +00:00
2022-04-18 23:36:09 +00:00
overlay.buttonMode = true;
// FlxG.stage.addChild(overlay);
2021-04-10 06:53:23 +00:00
2022-04-18 23:36:09 +00:00
}
2021-04-10 06:53:23 +00:00
*/
2021-04-09 23:17:14 +00:00
// netConnection.addEventListener(MouseEvent.MOUSE_DOWN, overlay_onMouseDown);
2021-02-15 00:45:18 +00:00
new FlxTimer().start(1, function(tmr:FlxTimer)
{
startIntro();
});
2020-10-30 23:47:19 +00:00
}
2021-04-09 23:17:14 +00:00
private function client_onMetaData(metaData:Dynamic)
{
video.attachNetStream(netStream);
video.width = video.videoWidth;
video.height = video.videoHeight;
2021-04-10 02:49:25 +00:00
// video.
2021-04-09 23:17:14 +00:00
}
private function netStream_onAsyncError(event:AsyncErrorEvent):Void
{
trace("Error loading video");
}
private function netConnection_onNetStatus(event:NetStatusEvent):Void
{
if (event.info.code == 'NetStream.Play.Complete')
{
2021-04-10 06:53:23 +00:00
// netStream.dispose();
// FlxG.stage.removeChild(video);
2021-04-09 23:17:14 +00:00
startIntro();
}
trace(event.toString());
}
private function overlay_onMouseDown(event:MouseEvent):Void
{
2021-04-10 02:49:25 +00:00
netStream.soundTransform.volume = 0.2;
netStream.soundTransform.pan = -1;
2021-04-10 06:53:23 +00:00
// netStream.play(Paths.file('music/kickstarterTrailer.mp4'));
2021-04-10 02:49:25 +00:00
2021-04-09 23:17:14 +00:00
FlxG.stage.removeChild(overlay);
}
2020-11-01 19:16:22 +00:00
var logoBl:FlxSprite;
2021-08-19 03:00:39 +00:00
var outlineShaderShit:TitleOutline;
2021-04-09 23:17:14 +00:00
2020-11-01 19:16:22 +00:00
var gfDance:FlxSprite;
var danceLeft:Bool = false;
var titleText:FlxSprite;
2020-10-30 23:47:19 +00:00
function startIntro()
{
2021-04-22 19:36:56 +00:00
if (FlxG.sound.music == null || !FlxG.sound.music.playing)
{
2021-02-08 21:34:48 +00:00
FlxG.sound.playMusic(Paths.music('freakyMenu'), 0);
2020-11-01 01:11:14 +00:00
FlxG.sound.music.fadeIn(4, 0, 0.7);
2022-04-18 23:36:09 +00:00
Conductor.bpm = Constants.FREAKY_MENU_BPM;
2020-10-05 18:24:51 +00:00
}
persistentUpdate = true;
2020-11-01 19:16:22 +00:00
var bg:FlxSprite = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, FlxColor.BLACK);
2020-10-05 18:24:51 +00:00
add(bg);
2020-11-01 19:16:22 +00:00
logoBl = new FlxSprite(-150, -100);
2021-02-08 21:34:48 +00:00
logoBl.frames = Paths.getSparrowAtlas('logoBumpin');
2020-11-01 19:16:22 +00:00
logoBl.antialiasing = true;
logoBl.animation.addByPrefix('bump', 'logo bumpin', 24);
logoBl.animation.play('bump');
2021-04-06 22:12:31 +00:00
2020-11-01 19:16:22 +00:00
logoBl.updateHitbox();
2021-03-20 04:48:17 +00:00
2021-08-19 03:00:39 +00:00
outlineShaderShit = new TitleOutline();
2021-08-17 05:20:00 +00:00
// logoBl.shader = swagShader.shader;
2021-08-21 23:53:08 +00:00
// logoBl.shader = outlineShaderShit;
2021-03-20 19:20:00 +00:00
2021-03-20 04:48:17 +00:00
// trace();
2020-11-01 19:16:22 +00:00
// logoBl.screenCenter();
// logoBl.color = FlxColor.BLACK;
gfDance = new FlxSprite(FlxG.width * 0.4, FlxG.height * 0.07);
2021-02-08 21:34:48 +00:00
gfDance.frames = Paths.getSparrowAtlas('gfDanceTitle');
2020-11-01 19:16:22 +00:00
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);
gfDance.antialiasing = true;
add(gfDance);
2021-03-20 18:55:29 +00:00
2021-08-27 06:42:23 +00:00
// alphaShader.shader.funnyShit.input = gfDance.pixels; // old shit
logoBl.shader = alphaShader.shader;
// trace(alphaShader.shader.glFragmentSource)
2021-08-21 23:53:08 +00:00
// gfDance.shader = swagShader.shader;
2021-03-20 18:55:29 +00:00
2021-08-17 05:20:00 +00:00
// gfDance.shader = new TitleOutline();
2020-10-05 18:24:51 +00:00
add(logoBl);
2020-11-01 19:16:22 +00:00
titleText = new FlxSprite(100, FlxG.height * 0.8);
2021-02-08 21:34:48 +00:00
titleText.frames = Paths.getSparrowAtlas('titleEnter');
2020-11-01 19:16:22 +00:00
titleText.animation.addByPrefix('idle', "Press Enter to Begin", 24);
titleText.animation.addByPrefix('press', "ENTER PRESSED", 24);
titleText.antialiasing = true;
titleText.animation.play('idle');
titleText.updateHitbox();
// titleText.screenCenter(X);
add(titleText);
2020-10-21 06:23:39 +00:00
credGroup = new FlxGroup();
add(credGroup);
2021-07-15 00:32:09 +00:00
2020-10-30 23:47:19 +00:00
textGroup = new FlxGroup();
2020-10-21 06:23:39 +00:00
blackScreen = bg.clone();
2020-10-21 06:23:39 +00:00
credGroup.add(blackScreen);
2022-04-18 23:36:09 +00:00
credGroup.add(textGroup);
2020-10-21 06:23:39 +00:00
2021-03-31 17:08:55 +00:00
// var atlasBullShit:FlxSprite = new FlxSprite();
// atlasBullShit.frames = CoolUtil.fromAnimate(Paths.image('money'), Paths.file('images/money.json'));
// credGroup.add(atlasBullShit);
2021-05-14 21:53:34 +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));
}
2020-11-01 01:11:14 +00:00
add(ngSpr);
ngSpr.visible = false;
2021-05-14 21:53:34 +00:00
2020-11-01 01:11:14 +00:00
ngSpr.updateHitbox();
ngSpr.screenCenter(X);
ngSpr.antialiasing = true;
2020-10-21 06:23:39 +00:00
2020-11-01 19:16:22 +00:00
FlxG.mouse.visible = false;
2020-11-01 01:11:14 +00:00
if (initialized)
skipIntro();
else
initialized = true;
2020-10-05 18:24:51 +00:00
2021-04-10 06:53:23 +00:00
if (FlxG.sound.music != null)
FlxG.sound.music.onComplete = function() FlxG.switchState(new VideoState());
2020-10-05 18:24:51 +00:00
}
2020-11-16 20:29:18 +00:00
function getIntroTextShit():Array<Array<String>>
{
var fullText:String = Assets.getText(Paths.txt('introText'));
2020-11-16 20:29:18 +00:00
var firstArray:Array<String> = fullText.split('\n');
var swagGoodArray:Array<Array<String>> = [];
for (i in firstArray)
{
swagGoodArray.push(i.split('--'));
}
return swagGoodArray;
}
2020-10-05 18:24:51 +00:00
var transitioning:Bool = false;
override function update(elapsed:Float)
{
#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
2021-08-21 23:53:08 +00:00
/* if (FlxG.onMobile)
2022-04-18 23:36:09 +00:00
{
if (gfDance != null)
2021-08-21 23:53:08 +00:00
{
2022-04-18 23:36:09 +00:00
gfDance.x = (FlxG.width / 2) + (FlxG.accelerometer.x * (FlxG.width / 2));
// gfDance.y = (FlxG.height / 2) + (FlxG.accelerometer.y * (FlxG.height / 2));
2021-08-21 23:53:08 +00:00
}
2022-04-18 23:36:09 +00:00
}
2021-08-21 23:53:08 +00:00
*/
2021-08-19 03:00:39 +00:00
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;
2021-07-14 23:00:22 +00:00
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});
}
/*
2022-04-18 23:36:09 +00:00
FlxG.watch.addQuick('cur display', FlxG.stage.window.display.id);
if (FlxG.keys.justPressed.Y)
{
// trace(FlxG.stage.window.display.name);
2022-04-18 23:36:09 +00:00
if (FlxG.gamepads.firstActive != null)
{
trace(FlxG.gamepads.firstActive.model);
FlxG.gamepads.firstActive.id
}
else
trace('gamepad null');
2022-04-18 23:36:09 +00:00
// FlxG.stage.window.title = Std.string(FlxG.random.int(0, 20000));
// FlxG.stage.window.setIcon(Image.fromFile('assets/images/icon16.png'));
// FlxG.stage.window.readPixels;
2022-04-18 23:36:09 +00:00
if (FlxG.stage.window.width == Std.int(FlxG.stage.window.display.bounds.width))
{
FlxG.stage.window.width = 1280;
FlxG.stage.window.height = 720;
FlxG.stage.window.y = 30;
}
2022-04-18 23:36:09 +00:00
else
{
FlxG.stage.window.width = Std.int(FlxG.stage.window.display.bounds.width);
FlxG.stage.window.height = Std.int(FlxG.stage.window.display.bounds.height);
FlxG.stage.window.x = Std.int(FlxG.stage.window.display.bounds.x);
FlxG.stage.window.y = Std.int(FlxG.stage.window.display.bounds.y);
}
}
*/
2021-04-22 19:36:56 +00:00
#if debug
2021-04-06 22:12:31 +00:00
if (FlxG.keys.justPressed.EIGHT)
FlxG.switchState(new CutsceneAnimTestState());
2021-04-22 19:36:56 +00:00
#end
2021-04-06 22:12:31 +00:00
2021-02-15 00:45:18 +00:00
if (FlxG.sound.music != null)
Conductor.songPosition = FlxG.sound.music.time;
2020-11-07 02:17:27 +00:00
if (FlxG.keys.justPressed.F)
FlxG.fullscreen = !FlxG.fullscreen;
// do controls.PAUSE | controls.ACCEPT instead?
2020-10-09 07:29:00 +00:00
var pressedEnter:Bool = FlxG.keys.justPressed.ENTER;
2021-08-22 20:54:22 +00:00
if (FlxG.onMobile)
2021-02-24 04:32:53 +00:00
{
2021-08-22 20:54:22 +00:00
for (touch in FlxG.touches.list)
2021-08-17 05:20:00 +00:00
{
2021-08-22 20:54:22 +00:00
if (touch.justPressed)
{
FlxG.switchState(new FreeplayState());
pressedEnter = true;
}
2021-08-17 05:20:00 +00:00
}
2021-02-24 04:32:53 +00:00
}
2021-08-22 20:54:22 +00:00
2020-10-09 07:29:00 +00:00
var gamepad:FlxGamepad = FlxG.gamepads.lastActive;
if (gamepad != null)
{
if (gamepad.justPressed.START)
pressedEnter = true;
2020-11-03 09:12:13 +00:00
#if switch
if (gamepad.justPressed.B)
pressedEnter = true;
#end
2020-10-09 07:29:00 +00:00
}
// a faster intro thing lol!
if (pressedEnter && transitioning && skippedIntro)
{
FlxG.switchState(new MainMenuState());
}
2020-10-21 18:05:27 +00:00
if (pressedEnter && !transitioning && skippedIntro)
2020-10-05 18:24:51 +00:00
{
2021-04-10 06:53:23 +00:00
if (FlxG.sound.music != null)
FlxG.sound.music.onComplete = null;
// netStream.play(Paths.file('music/kickstarterTrailer.mp4'));
2020-11-01 19:16:22 +00:00
NGio.unlockMedal(60960);
2020-11-07 02:17:27 +00:00
// If it's Friday according to da clock
if (Date.now().getDay() == 5)
NGio.unlockMedal(61034);
2020-11-01 19:16:22 +00:00
titleText.animation.play('press');
2020-10-05 18:33:56 +00:00
FlxG.camera.flash(FlxColor.WHITE, 1);
2021-02-08 21:34:48 +00:00
FlxG.sound.play(Paths.sound('confirmMenu'), 0.7);
2020-10-05 18:24:51 +00:00
transitioning = true;
2021-06-09 03:05:38 +00:00
var targetState:FlxState = new MainMenuState();
2021-06-09 03:05:38 +00:00
2021-03-27 23:11:14 +00:00
#if newgrounds
2021-02-18 19:58:16 +00:00
if (!OutdatedSubState.leftState)
2020-10-05 18:24:51 +00:00
{
2021-02-18 19:58:16 +00:00
NGio.checkVersion(function(version)
{
2021-02-18 19:58:16 +00:00
// Check if version is outdated
var localVersion:String = "v" + Application.current.meta.get('version');
var onlineVersion = version.split(" ")[0].trim();
if (version.trim() != onlineVersion)
{
trace('OLD VERSION!');
// targetState = new OutdatedSubState();
2021-02-18 19:58:16 +00:00
}
else
{
// targetState = new MainMenuState();
2021-02-18 19:58:16 +00:00
}
2021-04-18 17:23:09 +00:00
// REDO FOR ITCH/FINAL SHIT
2021-02-18 19:58:16 +00:00
});
}
2021-02-20 02:11:33 +00:00
#end
new FlxTimer().start(2, function(tmr:FlxTimer)
{
// 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'));
// ngSpr??
2022-04-18 23:36:09 +00:00
FlxG.switchState(targetState);
});
2021-02-08 21:34:48 +00:00
// FlxG.sound.play(Paths.music('titleShoot'), 0.7);
2020-11-01 01:11:14 +00:00
}
if (pressedEnter && !skippedIntro && initialized)
2020-11-01 01:11:14 +00:00
skipIntro();
2021-04-10 06:53:23 +00:00
/*
2022-04-18 23:36:09 +00:00
#if web
if (!initialized && controls.ACCEPT)
{
// netStream.dispose();
// FlxG.stage.removeChild(video);
2020-10-05 18:24:51 +00:00
2022-04-18 23:36:09 +00:00
startIntro();
skipIntro();
}
#end
2021-04-10 06:53:23 +00:00
*/
2021-04-09 23:17:14 +00:00
2021-03-23 04:05:46 +00:00
if (controls.UI_LEFT)
2021-03-21 18:45:46 +00:00
swagShader.update(-elapsed * 0.1);
2021-03-23 04:05:46 +00:00
if (controls.UI_RIGHT)
2021-03-21 18:45:46 +00:00
swagShader.update(elapsed * 0.1);
if (!cheatActive && skippedIntro)
cheatCodeShit();
2020-10-05 18:24:51 +00:00
super.update(elapsed);
}
2020-10-21 06:23:39 +00:00
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(FlxObject.DOWN);
if (controls.NOTE_UP_P || controls.UI_UP_P)
codePress(FlxObject.UP);
if (controls.NOTE_LEFT_P || controls.UI_LEFT_P)
codePress(FlxObject.LEFT);
if (controls.NOTE_RIGHT_P || controls.UI_RIGHT_P)
codePress(FlxObject.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);
2021-09-17 18:12:36 +00:00
var spec:SpectogramSprite = new SpectogramSprite(FlxG.sound.music);
add(spec);
2022-04-18 23:36:09 +00:00
Conductor.bpm = 190;
FlxG.camera.flash(FlxColor.WHITE, 1);
FlxG.sound.play(Paths.sound('confirmMenu'), 0.7);
}
2020-10-30 23:47:19 +00:00
function createCoolText(textArray:Array<String>)
{
2022-04-18 23:36:09 +00:00
if (credGroup == null || textGroup == null)
return;
2020-10-30 23:47:19 +00:00
for (i in 0...textArray.length)
{
2022-04-18 23:36:09 +00:00
var money:AtlasText = new AtlasText(0, 0, textArray[i], AtlasFont.BOLD);
2020-10-30 23:47:19 +00:00
money.screenCenter(X);
money.y += (i * 60) + 200;
2022-04-18 23:36:09 +00:00
// credGroup.add(money);
2020-10-30 23:47:19 +00:00
textGroup.add(money);
}
}
function addMoreText(text:String)
{
2022-04-18 23:36:09 +00:00
if (credGroup == null || textGroup == null)
return;
2021-08-21 23:53:08 +00:00
lime.ui.Haptic.vibrate(100, 100);
var coolText:AtlasText = new AtlasText(0, 0, text.trim(), AtlasFont.BOLD);
2020-10-30 23:47:19 +00:00
coolText.screenCenter(X);
coolText.y += (textGroup.length * 60) + 200;
textGroup.add(coolText);
}
function deleteCoolText()
{
2022-04-18 23:36:09 +00:00
if (credGroup == null || textGroup == null)
return;
2020-10-30 23:47:19 +00:00
while (textGroup.members.length > 0)
{
2022-04-18 23:36:09 +00:00
// credGroup.remove(textGroup.members[0], true);
2020-10-30 23:47:19 +00:00
textGroup.remove(textGroup.members[0], true);
}
}
2021-03-21 18:45:46 +00:00
var isRainbow:Bool = false;
var skippedIntro:Bool = false;
2021-03-21 18:45:46 +00:00
2022-04-18 23:36:09 +00:00
override function beatHit():Bool
2020-10-21 06:23:39 +00:00
{
2022-04-18 23:36:09 +00:00
// super.beatHit() returns false if a module cancelled the event.
if (!super.beatHit())
return false;
2020-10-21 06:23:39 +00:00
if (!skippedIntro)
2020-10-21 06:23:39 +00:00
{
2021-04-22 19:36:56 +00:00
FlxG.log.add(curBeat);
// if the user is draggin the window some beats will
// be missed so this is just to compensate
if (curBeat > lastBeat)
{
2021-04-22 19:36:56 +00:00
for (i in lastBeat...curBeat)
{
2021-04-22 19:36:56 +00:00
switch (i + 1)
{
case 1:
createCoolText(['ninjamuffin99', 'phantomArcade', 'kawaisprite', 'evilsk8r']);
2021-04-22 19:36:56 +00:00
case 3:
addMoreText('present');
case 4:
deleteCoolText();
case 5:
createCoolText(['In association', 'with']);
case 7:
addMoreText('newgrounds');
ngSpr.visible = true;
case 8:
deleteCoolText();
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');
2021-04-22 19:36:56 +00:00
case 16:
skipIntro();
}
}
}
2021-04-22 19:36:56 +00:00
lastBeat = curBeat;
2020-10-21 18:05:27 +00:00
}
if (skippedIntro)
{
if (cheatActive && curBeat % 2 == 0)
swagShader.update(0.125);
2020-10-21 18:05:27 +00:00
logoBl.animation.play('bump', true);
danceLeft = !danceLeft;
if (danceLeft)
gfDance.animation.play('danceRight');
else
gfDance.animation.play('danceLeft');
}
2022-04-18 23:36:09 +00:00
return true;
}
2020-10-21 18:05:27 +00:00
function skipIntro():Void
{
if (!skippedIntro)
{
2020-11-01 01:11:14 +00:00
remove(ngSpr);
2020-10-21 18:05:27 +00:00
FlxG.camera.flash(FlxColor.WHITE, 4);
remove(credGroup);
2020-10-30 23:47:19 +00:00
skippedIntro = true;
2020-10-21 06:23:39 +00:00
}
}
2020-10-05 18:24:51 +00:00
}