2020-10-05 14:24:51 -04:00
|
|
|
package;
|
|
|
|
|
|
|
|
import flixel.FlxG;
|
|
|
|
import flixel.FlxSprite;
|
|
|
|
import flixel.FlxState;
|
|
|
|
import flixel.addons.display.FlxGridOverlay;
|
|
|
|
import flixel.addons.transition.FlxTransitionSprite.GraphicTransTileDiamond;
|
|
|
|
import flixel.addons.transition.FlxTransitionableState;
|
|
|
|
import flixel.addons.transition.TransitionData;
|
|
|
|
import flixel.graphics.FlxGraphic;
|
2020-10-21 02:23:39 -04:00
|
|
|
import flixel.group.FlxGroup;
|
2020-10-09 03:29:00 -04:00
|
|
|
import flixel.input.gamepad.FlxGamepad;
|
2020-10-05 14:24:51 -04:00
|
|
|
import flixel.math.FlxPoint;
|
|
|
|
import flixel.math.FlxRect;
|
2020-10-21 02:23:39 -04:00
|
|
|
import flixel.text.FlxText;
|
2020-10-05 14:24:51 -04:00
|
|
|
import flixel.tweens.FlxEase;
|
|
|
|
import flixel.tweens.FlxTween;
|
|
|
|
import flixel.util.FlxColor;
|
|
|
|
import flixel.util.FlxTimer;
|
|
|
|
|
2020-10-21 02:23:39 -04:00
|
|
|
class TitleState extends MusicBeatState
|
2020-10-05 14:24:51 -04:00
|
|
|
{
|
|
|
|
static var initialized:Bool = false;
|
2020-10-06 21:56:14 -04:00
|
|
|
static public var soundExt:String = ".mp3";
|
2020-10-05 14:24:51 -04:00
|
|
|
|
2020-10-21 02:23:39 -04:00
|
|
|
var blackScreen:FlxSprite;
|
|
|
|
var credGroup:FlxGroup;
|
2020-10-27 04:31:21 -04:00
|
|
|
var credTextShit:Alphabet;
|
|
|
|
var textGroup:FlxGroup;
|
2020-10-21 02:23:39 -04:00
|
|
|
|
2020-10-05 14:24:51 -04:00
|
|
|
override public function create():Void
|
|
|
|
{
|
2020-10-06 21:56:14 -04:00
|
|
|
#if (!web)
|
|
|
|
TitleState.soundExt = '.ogg';
|
|
|
|
#end
|
|
|
|
|
2020-10-05 14:24:51 -04:00
|
|
|
super.create();
|
|
|
|
|
|
|
|
if (!initialized)
|
|
|
|
{
|
|
|
|
var diamond:FlxGraphic = FlxGraphic.fromClass(GraphicTransTileDiamond);
|
|
|
|
diamond.persist = true;
|
|
|
|
diamond.destroyOnNoUse = false;
|
|
|
|
|
|
|
|
FlxTransitionableState.defaultTransIn = new TransitionData(FADE, FlxColor.BLACK, 2, new FlxPoint(0, -1), {asset: diamond, width: 32, height: 32},
|
|
|
|
new FlxRect(0, 0, FlxG.width, FlxG.height));
|
|
|
|
FlxTransitionableState.defaultTransOut = new TransitionData(FADE, FlxColor.BLACK, 1.3, new FlxPoint(0, 1),
|
|
|
|
{asset: diamond, width: 32, height: 32}, new FlxRect(0, 0, FlxG.width, FlxG.height));
|
|
|
|
|
|
|
|
initialized = true;
|
|
|
|
|
|
|
|
FlxTransitionableState.defaultTransIn.tileData = {asset: diamond, width: 32, height: 32};
|
|
|
|
FlxTransitionableState.defaultTransOut.tileData = {asset: diamond, width: 32, height: 32};
|
|
|
|
|
|
|
|
transIn = FlxTransitionableState.defaultTransIn;
|
|
|
|
transOut = FlxTransitionableState.defaultTransOut;
|
|
|
|
}
|
|
|
|
|
|
|
|
persistentUpdate = true;
|
|
|
|
|
2020-10-05 18:29:59 -04:00
|
|
|
var bg:FlxSprite = new FlxSprite().loadGraphic(AssetPaths.stageback__png);
|
|
|
|
bg.antialiasing = true;
|
|
|
|
bg.setGraphicSize(Std.int(bg.width * 0.6));
|
|
|
|
bg.updateHitbox();
|
2020-10-05 14:24:51 -04:00
|
|
|
add(bg);
|
|
|
|
|
|
|
|
var logoBl:FlxSprite = new FlxSprite().loadGraphic(AssetPaths.logo__png);
|
|
|
|
logoBl.screenCenter();
|
|
|
|
logoBl.color = FlxColor.BLACK;
|
|
|
|
add(logoBl);
|
|
|
|
|
|
|
|
var logo:FlxSprite = new FlxSprite().loadGraphic(AssetPaths.logo__png);
|
|
|
|
logo.screenCenter();
|
2020-10-05 18:29:59 -04:00
|
|
|
logo.antialiasing = true;
|
2020-10-05 14:24:51 -04:00
|
|
|
add(logo);
|
|
|
|
|
|
|
|
FlxTween.tween(logoBl, {y: logoBl.y + 50}, 0.6, {ease: FlxEase.quadInOut, type: PINGPONG});
|
|
|
|
FlxTween.tween(logo, {y: logoBl.y + 50}, 0.6, {ease: FlxEase.quadInOut, type: PINGPONG, startDelay: 0.1});
|
|
|
|
|
2020-10-21 02:23:39 -04:00
|
|
|
credGroup = new FlxGroup();
|
|
|
|
add(credGroup);
|
2020-10-27 04:31:21 -04:00
|
|
|
textGroup = new FlxGroup();
|
2020-10-21 02:23:39 -04:00
|
|
|
|
|
|
|
blackScreen = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, FlxColor.BLACK);
|
|
|
|
credGroup.add(blackScreen);
|
|
|
|
|
2020-10-27 04:31:21 -04:00
|
|
|
credTextShit = new Alphabet(0, 0, "ninjamuffin99\nPhantomArcade\nkawaisprite\nevilsk8er", true);
|
2020-10-21 02:23:39 -04:00
|
|
|
credTextShit.screenCenter();
|
2020-10-27 04:31:21 -04:00
|
|
|
|
|
|
|
// credTextShit.alignment = CENTER;
|
2020-10-21 02:23:39 -04:00
|
|
|
|
|
|
|
credTextShit.visible = false;
|
|
|
|
|
|
|
|
FlxTween.tween(credTextShit, {y: credTextShit.y + 20}, 2.9, {ease: FlxEase.quadInOut, type: PINGPONG});
|
|
|
|
|
2020-10-27 04:31:21 -04:00
|
|
|
// credGroup.add(credTextShit);
|
2020-10-21 02:23:39 -04:00
|
|
|
|
|
|
|
FlxG.sound.playMusic('assets/music/freakyMenu' + TitleState.soundExt, 0, false);
|
2020-10-05 14:24:51 -04:00
|
|
|
|
|
|
|
FlxG.sound.music.fadeIn(4, 0, 0.7);
|
|
|
|
}
|
|
|
|
|
|
|
|
var transitioning:Bool = false;
|
|
|
|
|
|
|
|
override function update(elapsed:Float)
|
|
|
|
{
|
2020-10-21 02:23:39 -04:00
|
|
|
Conductor.songPosition = FlxG.sound.music.time;
|
|
|
|
|
2020-10-09 03:29:00 -04:00
|
|
|
var pressedEnter:Bool = FlxG.keys.justPressed.ENTER;
|
|
|
|
|
|
|
|
var gamepad:FlxGamepad = FlxG.gamepads.lastActive;
|
|
|
|
|
|
|
|
if (gamepad != null)
|
|
|
|
{
|
|
|
|
if (gamepad.justPressed.START)
|
|
|
|
pressedEnter = true;
|
|
|
|
}
|
|
|
|
|
2020-10-21 14:05:27 -04:00
|
|
|
if (pressedEnter && !skippedIntro)
|
|
|
|
{
|
|
|
|
skipIntro();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pressedEnter && !transitioning && skippedIntro)
|
2020-10-05 14:24:51 -04:00
|
|
|
{
|
2020-10-05 14:33:56 -04:00
|
|
|
FlxG.camera.flash(FlxColor.WHITE, 1);
|
|
|
|
|
2020-10-05 14:24:51 -04:00
|
|
|
transitioning = true;
|
|
|
|
FlxG.sound.music.stop();
|
|
|
|
|
|
|
|
new FlxTimer().start(2, function(tmr:FlxTimer)
|
|
|
|
{
|
2020-10-27 06:35:23 -04:00
|
|
|
FlxG.switchState(new FreeplayState());
|
2020-10-05 14:24:51 -04:00
|
|
|
});
|
2020-10-06 21:56:14 -04:00
|
|
|
FlxG.sound.play('assets/music/titleShoot' + TitleState.soundExt, 0.7);
|
2020-10-05 14:24:51 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
super.update(elapsed);
|
|
|
|
}
|
2020-10-21 02:23:39 -04:00
|
|
|
|
2020-10-27 04:31:21 -04:00
|
|
|
function createCoolText(textArray:Array<String>)
|
|
|
|
{
|
|
|
|
for (i in 0...textArray.length)
|
|
|
|
{
|
|
|
|
var money:Alphabet = new Alphabet(0, 0, textArray[i], true, false);
|
|
|
|
money.screenCenter(X);
|
|
|
|
money.y += (i * 60) + 200;
|
|
|
|
credGroup.add(money);
|
|
|
|
textGroup.add(money);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function addMoreText(text:String)
|
|
|
|
{
|
|
|
|
var coolText:Alphabet = new Alphabet(0, 0, text, true, false);
|
|
|
|
coolText.screenCenter(X);
|
|
|
|
coolText.y += (textGroup.length * 60) + 200;
|
|
|
|
credGroup.add(coolText);
|
|
|
|
textGroup.add(coolText);
|
|
|
|
}
|
|
|
|
|
|
|
|
function deleteCoolText()
|
|
|
|
{
|
|
|
|
while (textGroup.members.length > 0)
|
|
|
|
{
|
|
|
|
credGroup.remove(textGroup.members[0], true);
|
|
|
|
textGroup.remove(textGroup.members[0], true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-21 02:23:39 -04:00
|
|
|
override function beatHit()
|
|
|
|
{
|
|
|
|
super.beatHit();
|
|
|
|
|
|
|
|
FlxG.log.add(curBeat);
|
|
|
|
|
|
|
|
switch (curBeat)
|
|
|
|
{
|
|
|
|
case 1:
|
2020-10-27 04:31:21 -04:00
|
|
|
createCoolText(['ninjamuffin99', 'phantomArcade', 'kawaisprite', 'evilsk8er']);
|
|
|
|
// credTextShit.visible = true;
|
2020-10-21 02:23:39 -04:00
|
|
|
case 3:
|
2020-10-27 04:31:21 -04:00
|
|
|
addMoreText('present');
|
|
|
|
// credTextShit.text += '\npresent...';
|
|
|
|
// credTextShit.addText();
|
2020-10-21 02:23:39 -04:00
|
|
|
case 4:
|
2020-10-27 04:31:21 -04:00
|
|
|
deleteCoolText();
|
|
|
|
// credTextShit.visible = false;
|
|
|
|
// credTextShit.text = 'In association \nwith';
|
|
|
|
// credTextShit.screenCenter();
|
2020-10-21 02:23:39 -04:00
|
|
|
case 5:
|
2020-10-27 04:31:21 -04:00
|
|
|
createCoolText(['In association', 'with']);
|
2020-10-21 02:23:39 -04:00
|
|
|
case 7:
|
2020-10-27 04:31:21 -04:00
|
|
|
addMoreText('newgrounds');
|
|
|
|
// credTextShit.text += '\nNewgrounds';
|
2020-10-21 02:23:39 -04:00
|
|
|
case 8:
|
2020-10-27 04:31:21 -04:00
|
|
|
deleteCoolText();
|
|
|
|
// credTextShit.visible = false;
|
|
|
|
|
|
|
|
// credTextShit.text = 'Shoutouts Tom Fulp';
|
|
|
|
// credTextShit.screenCenter();
|
2020-10-21 02:23:39 -04:00
|
|
|
case 9:
|
2020-10-27 04:31:21 -04:00
|
|
|
createCoolText(['Shoutouts Tom Fulp']);
|
|
|
|
// credTextShit.visible = true;
|
2020-10-21 02:23:39 -04:00
|
|
|
case 11:
|
2020-10-27 04:31:21 -04:00
|
|
|
addMoreText('lmao');
|
|
|
|
// credTextShit.text += '\nlmao';
|
2020-10-21 02:23:39 -04:00
|
|
|
case 12:
|
2020-10-27 04:31:21 -04:00
|
|
|
deleteCoolText();
|
|
|
|
// credTextShit.visible = false;
|
|
|
|
// credTextShit.text = "Friday";
|
|
|
|
// credTextShit.screenCenter();
|
2020-10-21 02:23:39 -04:00
|
|
|
case 13:
|
2020-10-27 04:31:21 -04:00
|
|
|
addMoreText('Friday');
|
|
|
|
// credTextShit.visible = true;
|
2020-10-21 02:23:39 -04:00
|
|
|
case 14:
|
2020-10-27 04:31:21 -04:00
|
|
|
addMoreText('Night');
|
|
|
|
// credTextShit.text += '\nNight';
|
2020-10-21 02:23:39 -04:00
|
|
|
case 15:
|
2020-10-27 04:31:21 -04:00
|
|
|
addMoreText('Funkin'); // credTextShit.text += '\nFunkin';
|
2020-10-21 02:23:39 -04:00
|
|
|
|
|
|
|
case 16:
|
2020-10-21 14:05:27 -04:00
|
|
|
skipIntro();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var skippedIntro:Bool = false;
|
|
|
|
|
|
|
|
function skipIntro():Void
|
|
|
|
{
|
|
|
|
if (!skippedIntro)
|
|
|
|
{
|
|
|
|
FlxG.camera.flash(FlxColor.WHITE, 4);
|
|
|
|
remove(credGroup);
|
2020-10-27 06:35:23 -04:00
|
|
|
skippedIntro = true;
|
2020-10-21 02:23:39 -04:00
|
|
|
}
|
|
|
|
}
|
2020-10-05 14:24:51 -04:00
|
|
|
}
|