diff --git a/source/Alphabet.hx b/source/Alphabet.hx index bb8cce924..20556e359 100644 --- a/source/Alphabet.hx +++ b/source/Alphabet.hx @@ -17,6 +17,8 @@ class Alphabet extends FlxSpriteGroup public var delay:Float = 0.05; public var paused:Bool = false; + public var text:String = ""; + var _finalText:String = ""; var _curText:String = ""; @@ -28,15 +30,79 @@ class Alphabet extends FlxSpriteGroup // amp, backslash, question mark, apostrophy, comma, angry faic, period var lastSprite:AlphaCharacter; var xPosResetted:Bool = false; + var lastWasSpace:Bool = false; - public function new(x:Float, y:Float, text:String = "", ?bold:Bool = false) + var splitWords:Array = []; + + public function new(x:Float, y:Float, text:String = "", ?bold:Bool = false, typed:Bool = false) { super(x, y); _finalText = text; + this.text = text; - var arrayShit:Array = text.split(""); - trace(arrayShit); + if (typed) + { + startTypedText(); + } + else + { + addText(); + } + } + + public function addText() + { + doSplitWords(); + + for (character in splitWords) + { + // if (character.fastCodeAt() == " ") + // { + // } + + if (character == " ") + { + lastWasSpace = true; + } + + if (AlphaCharacter.alphabet.contains(character.toLowerCase())) + { + var xPos:Float = 0; + if (lastSprite != null) + { + xPos = lastSprite.x + lastSprite.frameWidth; + } + + if (lastWasSpace) + { + xPos += 40; + lastWasSpace = false; + } + + // var letter:AlphaCharacter = new AlphaCharacter(30 * loopNum, 0); + var letter:AlphaCharacter = new AlphaCharacter(xPos, 0); + letter.createBold(character); + add(letter); + + lastSprite = letter; + } + + // loopNum += 1; + } + } + + function doSplitWords():Void + { + splitWords = _finalText.split(""); + } + + public function startTypedText():Void + { + _finalText = text; + doSplitWords(); + + // trace(arrayShit); var loopNum:Int = 0; @@ -52,7 +118,7 @@ class Alphabet extends FlxSpriteGroup // xPos = 0; } - if (AlphaCharacter.alphabet.contains(arrayShit[loopNum].toLowerCase())) + if (AlphaCharacter.alphabet.contains(splitWords[loopNum].toLowerCase())) { if (lastSprite != null && !xPosResetted) { @@ -67,7 +133,7 @@ class Alphabet extends FlxSpriteGroup // var letter:AlphaCharacter = new AlphaCharacter(30 * loopNum, 0); var letter:AlphaCharacter = new AlphaCharacter(xPos, 55 * yMulti); - letter.createBold(arrayShit[loopNum]); + letter.createBold(splitWords[loopNum]); add(letter); lastSprite = letter; @@ -76,32 +142,7 @@ class Alphabet extends FlxSpriteGroup loopNum += 1; tmr.time = FlxG.random.float(0.03, 0.09); - }, arrayShit.length); - - for (character in arrayShit) - { - // if (character.fastCodeAt() == " ") - // { - // } - - if (AlphaCharacter.alphabet.contains(character.toLowerCase())) - { - /* var xPos:Float = 0; - if (lastSprite != null) - { - xPos = lastSprite.x + lastSprite.frameWidth - 40; - } - - // var letter:AlphaCharacter = new AlphaCharacter(30 * loopNum, 0); - var letter:AlphaCharacter = new AlphaCharacter(xPos, 0); - letter.createBold(character); - add(letter); - - lastSprite = letter; */ - } - - // loopNum += 1; - } + }, splitWords.length); } override function update(elapsed:Float) diff --git a/source/Character.hx b/source/Character.hx index 85df3268f..0f881814a 100644 --- a/source/Character.hx +++ b/source/Character.hx @@ -73,7 +73,7 @@ class Character extends FlxSprite animation.addByPrefix('singDOWN', 'spooky DOWN note', 24, false); animation.addByPrefix('singLEFT', 'note sing left', 24, false); animation.addByPrefix('singRIGHT', 'spooky sing right', 24, false); - animation.addByIndices('danceLeft', 'spooky dance idle', [16, 0, 2, 6], "", 12, false); + animation.addByIndices('danceLeft', 'spooky dance idle', [0, 2, 6], "", 12, false); animation.addByIndices('danceRight', 'spooky dance idle', [8, 10, 12, 14], "", 12, false); addOffset('danceLeft'); diff --git a/source/ChartingState.hx b/source/ChartingState.hx index 87d0409f4..9483b506b 100644 --- a/source/ChartingState.hx +++ b/source/ChartingState.hx @@ -81,7 +81,7 @@ class ChartingState extends MusicBeatState else { _song = { - song: 'tutorial', + song: 'Spookeez', notes: [], bpm: 100, sections: 0, diff --git a/source/FreeplayState.hx b/source/FreeplayState.hx index f745d5da6..e10db5261 100644 --- a/source/FreeplayState.hx +++ b/source/FreeplayState.hx @@ -23,8 +23,9 @@ class FreeplayState extends MusicBeatState for (i in 0...songs.length) { - var songText:Alphabet = new Alphabet(40, (70 * i) + 30, songs[i]); + var songText:Alphabet = new Alphabet(40, (70 * i) + 30, songs[i], true, false); add(songText); + // songText.screenCenter(X); } selector = new FlxText(); diff --git a/source/Main.hx b/source/Main.hx index e2e0f4dee..13376db44 100644 --- a/source/Main.hx +++ b/source/Main.hx @@ -9,7 +9,7 @@ class Main extends Sprite public function new() { super(); - addChild(new FlxGame(0, 0, FreeplayState)); + addChild(new FlxGame(0, 0, TitleState)); #if !mobile addChild(new FPS(10, 3, 0xFFFFFF)); diff --git a/source/PlayState.hx b/source/PlayState.hx index ef165d435..48df0fea6 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -1200,6 +1200,12 @@ class PlayState extends MusicBeatState vocals.time = Conductor.songPosition; vocals.play(); } + + if (dad.curCharacter == 'spooky' && totalSteps % 4 == 2) + { + // dad.dance(); + } + super.stepHit(); } @@ -1219,7 +1225,9 @@ class PlayState extends MusicBeatState healthHeads.setGraphicSize(Std.int(healthHeads.width + 20)); if (totalBeats % gfSpeed == 0) + { gf.dance(); + } if (!boyfriend.animation.curAnim.name.startsWith("sing")) boyfriend.playAnim('idle'); diff --git a/source/TitleState.hx b/source/TitleState.hx index b575df457..5c5ed9413 100644 --- a/source/TitleState.hx +++ b/source/TitleState.hx @@ -25,7 +25,8 @@ class TitleState extends MusicBeatState var blackScreen:FlxSprite; var credGroup:FlxGroup; - var credTextShit:FlxText; + var credTextShit:Alphabet; + var textGroup:FlxGroup; override public function create():Void { @@ -78,19 +79,21 @@ class TitleState extends MusicBeatState credGroup = new FlxGroup(); add(credGroup); + textGroup = new FlxGroup(); blackScreen = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, FlxColor.BLACK); credGroup.add(blackScreen); - credTextShit = new FlxText(0, 0, 0, "ninjamuffin99\nPhantomArcade\nEvilsk8er\nAnd Kawaisprite", 24); + credTextShit = new Alphabet(0, 0, "ninjamuffin99\nPhantomArcade\nkawaisprite\nevilsk8er", true); credTextShit.screenCenter(); - credTextShit.alignment = CENTER; + + // credTextShit.alignment = CENTER; credTextShit.visible = false; FlxTween.tween(credTextShit, {y: credTextShit.y + 20}, 2.9, {ease: FlxEase.quadInOut, type: PINGPONG}); - credGroup.add(credTextShit); + // credGroup.add(credTextShit); FlxG.sound.playMusic('assets/music/freakyMenu' + TitleState.soundExt, 0, false); @@ -135,6 +138,36 @@ class TitleState extends MusicBeatState super.update(elapsed); } + function createCoolText(textArray:Array) + { + 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(); @@ -144,35 +177,47 @@ class TitleState extends MusicBeatState switch (curBeat) { case 1: - credTextShit.visible = true; + createCoolText(['ninjamuffin99', 'phantomArcade', 'kawaisprite', 'evilsk8er']); + // credTextShit.visible = true; case 3: - credTextShit.text += '\npresent...'; + addMoreText('present'); + // credTextShit.text += '\npresent...'; + // credTextShit.addText(); case 4: - credTextShit.visible = false; - credTextShit.text = 'In association \nwith'; - credTextShit.screenCenter(); + deleteCoolText(); + // credTextShit.visible = false; + // credTextShit.text = 'In association \nwith'; + // credTextShit.screenCenter(); case 5: - credTextShit.visible = true; + createCoolText(['In association', 'with']); case 7: - credTextShit.text += '\nNewgrounds'; + addMoreText('newgrounds'); + // credTextShit.text += '\nNewgrounds'; case 8: - credTextShit.visible = false; - credTextShit.text = 'Shoutouts Tom Fulp'; - credTextShit.screenCenter(); + deleteCoolText(); + // credTextShit.visible = false; + + // credTextShit.text = 'Shoutouts Tom Fulp'; + // credTextShit.screenCenter(); case 9: - credTextShit.visible = true; + createCoolText(['Shoutouts Tom Fulp']); + // credTextShit.visible = true; case 11: - credTextShit.text += '\nlmao'; + addMoreText('lmao'); + // credTextShit.text += '\nlmao'; case 12: - credTextShit.visible = false; - credTextShit.text = "Friday"; - credTextShit.screenCenter(); + deleteCoolText(); + // credTextShit.visible = false; + // credTextShit.text = "Friday"; + // credTextShit.screenCenter(); case 13: - credTextShit.visible = true; + addMoreText('Friday'); + // credTextShit.visible = true; case 14: - credTextShit.text += '\nNight'; + addMoreText('Night'); + // credTextShit.text += '\nNight'; case 15: - credTextShit.text += '\nFunkin'; + addMoreText('Funkin'); // credTextShit.text += '\nFunkin'; case 16: skipIntro();