mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-11-04 13:54:22 +00:00
252 lines
6.2 KiB
Haxe
252 lines
6.2 KiB
Haxe
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;
|
|
import flixel.group.FlxGroup;
|
|
import flixel.input.gamepad.FlxGamepad;
|
|
import flixel.math.FlxPoint;
|
|
import flixel.math.FlxRect;
|
|
import flixel.text.FlxText;
|
|
import flixel.tweens.FlxEase;
|
|
import flixel.tweens.FlxTween;
|
|
import flixel.util.FlxColor;
|
|
import flixel.util.FlxTimer;
|
|
|
|
class TitleState extends MusicBeatState
|
|
{
|
|
static var initialized:Bool = false;
|
|
static public var soundExt:String = ".mp3";
|
|
|
|
var blackScreen:FlxSprite;
|
|
var credGroup:FlxGroup;
|
|
var credTextShit:Alphabet;
|
|
var textGroup:FlxGroup;
|
|
|
|
override public function create():Void
|
|
{
|
|
#if (!web)
|
|
TitleState.soundExt = '.ogg';
|
|
#end
|
|
|
|
PlayerSettings.init();
|
|
|
|
// DEBUG BULLSHIT
|
|
|
|
super.create();
|
|
|
|
#if SKIP_TO_PLAYSTATE
|
|
FlxG.switchState(new StoryMenuState());
|
|
#else
|
|
startIntro();
|
|
#end
|
|
}
|
|
|
|
function startIntro()
|
|
{
|
|
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;
|
|
|
|
var bg:FlxSprite = new FlxSprite().loadGraphic(AssetPaths.stageback__png);
|
|
bg.antialiasing = true;
|
|
bg.setGraphicSize(Std.int(bg.width * 0.6));
|
|
bg.updateHitbox();
|
|
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();
|
|
logo.antialiasing = true;
|
|
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});
|
|
|
|
credGroup = new FlxGroup();
|
|
add(credGroup);
|
|
textGroup = new FlxGroup();
|
|
|
|
blackScreen = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, FlxColor.BLACK);
|
|
credGroup.add(blackScreen);
|
|
|
|
credTextShit = new Alphabet(0, 0, "ninjamuffin99\nPhantomArcade\nkawaisprite\nevilsk8er", true);
|
|
credTextShit.screenCenter();
|
|
|
|
// credTextShit.alignment = CENTER;
|
|
|
|
credTextShit.visible = false;
|
|
|
|
FlxTween.tween(credTextShit, {y: credTextShit.y + 20}, 2.9, {ease: FlxEase.quadInOut, type: PINGPONG});
|
|
|
|
// credGroup.add(credTextShit);
|
|
|
|
FlxG.sound.playMusic('assets/music/freakyMenu' + TitleState.soundExt, 0, false);
|
|
|
|
FlxG.sound.music.fadeIn(4, 0, 0.7);
|
|
}
|
|
|
|
var transitioning:Bool = false;
|
|
|
|
override function update(elapsed:Float)
|
|
{
|
|
Conductor.songPosition = FlxG.sound.music.time;
|
|
|
|
var pressedEnter:Bool = FlxG.keys.justPressed.ENTER;
|
|
|
|
var gamepad:FlxGamepad = FlxG.gamepads.lastActive;
|
|
|
|
if (gamepad != null)
|
|
{
|
|
if (gamepad.justPressed.START)
|
|
pressedEnter = true;
|
|
}
|
|
|
|
if (pressedEnter && !skippedIntro)
|
|
{
|
|
skipIntro();
|
|
}
|
|
|
|
if (pressedEnter && !transitioning && skippedIntro)
|
|
{
|
|
FlxG.camera.flash(FlxColor.WHITE, 1);
|
|
|
|
transitioning = true;
|
|
FlxG.sound.music.stop();
|
|
|
|
new FlxTimer().start(2, function(tmr:FlxTimer)
|
|
{
|
|
FlxG.switchState(new FreeplayState());
|
|
});
|
|
FlxG.sound.play('assets/music/titleShoot' + TitleState.soundExt, 0.7);
|
|
}
|
|
|
|
super.update(elapsed);
|
|
}
|
|
|
|
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);
|
|
}
|
|
}
|
|
|
|
override function beatHit()
|
|
{
|
|
super.beatHit();
|
|
|
|
FlxG.log.add(curBeat);
|
|
|
|
switch (curBeat)
|
|
{
|
|
case 1:
|
|
createCoolText(['ninjamuffin99', 'phantomArcade', 'kawaisprite', 'evilsk8er']);
|
|
// credTextShit.visible = true;
|
|
case 3:
|
|
addMoreText('present');
|
|
// credTextShit.text += '\npresent...';
|
|
// credTextShit.addText();
|
|
case 4:
|
|
deleteCoolText();
|
|
// credTextShit.visible = false;
|
|
// credTextShit.text = 'In association \nwith';
|
|
// credTextShit.screenCenter();
|
|
case 5:
|
|
createCoolText(['In association', 'with']);
|
|
case 7:
|
|
addMoreText('newgrounds');
|
|
// credTextShit.text += '\nNewgrounds';
|
|
case 8:
|
|
deleteCoolText();
|
|
// credTextShit.visible = false;
|
|
|
|
// credTextShit.text = 'Shoutouts Tom Fulp';
|
|
// credTextShit.screenCenter();
|
|
case 9:
|
|
createCoolText(['Shoutouts Tom Fulp']);
|
|
// credTextShit.visible = true;
|
|
case 11:
|
|
addMoreText('lmao');
|
|
// credTextShit.text += '\nlmao';
|
|
case 12:
|
|
deleteCoolText();
|
|
// credTextShit.visible = false;
|
|
// credTextShit.text = "Friday";
|
|
// credTextShit.screenCenter();
|
|
case 13:
|
|
addMoreText('Friday');
|
|
// credTextShit.visible = true;
|
|
case 14:
|
|
addMoreText('Night');
|
|
// credTextShit.text += '\nNight';
|
|
case 15:
|
|
addMoreText('Funkin'); // credTextShit.text += '\nFunkin';
|
|
|
|
case 16:
|
|
skipIntro();
|
|
}
|
|
}
|
|
|
|
var skippedIntro:Bool = false;
|
|
|
|
function skipIntro():Void
|
|
{
|
|
if (!skippedIntro)
|
|
{
|
|
FlxG.camera.flash(FlxColor.WHITE, 4);
|
|
remove(credGroup);
|
|
skippedIntro = true;
|
|
}
|
|
}
|
|
}
|