diff --git a/art/BoyFriend_Assets.fla b/art/BoyFriend_Assets.fla new file mode 100644 index 000000000..5ec9206f4 Binary files /dev/null and b/art/BoyFriend_Assets.fla differ diff --git a/art/Dad_assets.fla b/art/Dad_assets.fla new file mode 100644 index 000000000..bfc25c3c1 Binary files /dev/null and b/art/Dad_assets.fla differ diff --git a/art/NOTE_assets.fla b/art/NOTE_assets.fla new file mode 100644 index 000000000..523cc95ef Binary files /dev/null and b/art/NOTE_assets.fla differ diff --git a/assets/data/bopeebo.json b/assets/data/bopeebo.json deleted file mode 100644 index bd1ac3d7e..000000000 --- a/assets/data/bopeebo.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "song": "Bopeebo", - "bpm": 100, - "data": [[1,0,0,0,2,-2,-2,-2,2,-2,-2,-2], - [3,-3,-3,0,4,-4,-4,0,2,-2,-2,0], - [3,-3,0,0,2,0,4,0,3,-3,-3,-3] - ] -} \ No newline at end of file diff --git a/assets/data/bopeebo/bopeebo.json b/assets/data/bopeebo/bopeebo.json new file mode 100644 index 000000000..403190481 --- /dev/null +++ b/assets/data/bopeebo/bopeebo.json @@ -0,0 +1,5 @@ +{ + "song": "Bopeebo", + "bpm": 100, + "sections": 15 +} \ No newline at end of file diff --git a/assets/data/bopeebo/section1.png b/assets/data/bopeebo/section1.png new file mode 100644 index 000000000..997ac5868 Binary files /dev/null and b/assets/data/bopeebo/section1.png differ diff --git a/assets/data/bopeebo/section10.png b/assets/data/bopeebo/section10.png new file mode 100644 index 000000000..64cbda377 Binary files /dev/null and b/assets/data/bopeebo/section10.png differ diff --git a/assets/data/bopeebo/section11.png b/assets/data/bopeebo/section11.png new file mode 100644 index 000000000..dbbee7ae4 Binary files /dev/null and b/assets/data/bopeebo/section11.png differ diff --git a/assets/data/bopeebo/section12.png b/assets/data/bopeebo/section12.png new file mode 100644 index 000000000..1d1cbbb9a Binary files /dev/null and b/assets/data/bopeebo/section12.png differ diff --git a/assets/data/bopeebo/section13.png b/assets/data/bopeebo/section13.png new file mode 100644 index 000000000..af985941d Binary files /dev/null and b/assets/data/bopeebo/section13.png differ diff --git a/assets/data/bopeebo/section14.png b/assets/data/bopeebo/section14.png new file mode 100644 index 000000000..1c161f78b Binary files /dev/null and b/assets/data/bopeebo/section14.png differ diff --git a/assets/data/bopeebo/section15.png b/assets/data/bopeebo/section15.png new file mode 100644 index 000000000..f9f0416a4 Binary files /dev/null and b/assets/data/bopeebo/section15.png differ diff --git a/assets/data/bopeebo/section2.png b/assets/data/bopeebo/section2.png new file mode 100644 index 000000000..22772b6ac Binary files /dev/null and b/assets/data/bopeebo/section2.png differ diff --git a/assets/data/bopeebo/section3.png b/assets/data/bopeebo/section3.png new file mode 100644 index 000000000..87d1f6b95 Binary files /dev/null and b/assets/data/bopeebo/section3.png differ diff --git a/assets/data/bopeebo/section4.png b/assets/data/bopeebo/section4.png new file mode 100644 index 000000000..81a0b7eee Binary files /dev/null and b/assets/data/bopeebo/section4.png differ diff --git a/assets/data/bopeebo/section5.png b/assets/data/bopeebo/section5.png new file mode 100644 index 000000000..ff06a490b Binary files /dev/null and b/assets/data/bopeebo/section5.png differ diff --git a/assets/data/bopeebo/section6.png b/assets/data/bopeebo/section6.png new file mode 100644 index 000000000..47d2e95cc Binary files /dev/null and b/assets/data/bopeebo/section6.png differ diff --git a/assets/data/bopeebo/section7.png b/assets/data/bopeebo/section7.png new file mode 100644 index 000000000..af985941d Binary files /dev/null and b/assets/data/bopeebo/section7.png differ diff --git a/assets/data/bopeebo/section8.png b/assets/data/bopeebo/section8.png new file mode 100644 index 000000000..1c161f78b Binary files /dev/null and b/assets/data/bopeebo/section8.png differ diff --git a/assets/data/bopeebo/section9.png b/assets/data/bopeebo/section9.png new file mode 100644 index 000000000..dbbee7ae4 Binary files /dev/null and b/assets/data/bopeebo/section9.png differ diff --git a/assets/data/section1.aseprite b/assets/data/section1.aseprite new file mode 100644 index 000000000..585312cfb Binary files /dev/null and b/assets/data/section1.aseprite differ diff --git a/assets/data/specialThanks.txt b/assets/data/specialThanks.txt index 317dba4e3..89fef66ec 100644 --- a/assets/data/specialThanks.txt +++ b/assets/data/specialThanks.txt @@ -1,2 +1,3 @@ wanda +fizzd kiddbrute \ No newline at end of file diff --git a/assets/images/BOYFRIEND.png b/assets/images/BOYFRIEND.png index a10324ee7..fb0b9a67f 100644 Binary files a/assets/images/BOYFRIEND.png and b/assets/images/BOYFRIEND.png differ diff --git a/assets/images/BOYFRIEND.xml b/assets/images/BOYFRIEND.xml new file mode 100644 index 000000000..aa029f6a4 --- /dev/null +++ b/assets/images/BOYFRIEND.xml @@ -0,0 +1,162 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/DADDY_DEAREST.png b/assets/images/DADDY_DEAREST.png index ef1498124..8f66d4606 100644 Binary files a/assets/images/DADDY_DEAREST.png and b/assets/images/DADDY_DEAREST.png differ diff --git a/assets/images/DADDY_DEAREST.xml b/assets/images/DADDY_DEAREST.xml new file mode 100644 index 000000000..86aef3b8f --- /dev/null +++ b/assets/images/DADDY_DEAREST.xml @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/NOTE_assets.png b/assets/images/NOTE_assets.png new file mode 100644 index 000000000..f8e8c8b61 Binary files /dev/null and b/assets/images/NOTE_assets.png differ diff --git a/assets/images/NOTE_assets.xml b/assets/images/NOTE_assets.xml new file mode 100644 index 000000000..aca9e248e --- /dev/null +++ b/assets/images/NOTE_assets.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/source/ChartParser.hx b/source/ChartParser.hx new file mode 100644 index 000000000..46b15743e --- /dev/null +++ b/source/ChartParser.hx @@ -0,0 +1,83 @@ +package; + +import flixel.util.FlxStringUtil; + +using StringTools; + +class ChartParser +{ + static public function parse(songName:String, section:Int):Array + { + var IMG_WIDTH:Int = 8; + var regex:EReg = new EReg("[ \t]*((\r\n)|\r|\n)[ \t]*", "g"); + + var csvData = FlxStringUtil.imageToCSV('assets/data/' + songName + '/section' + section + '.png'); + + var lines:Array = regex.split(csvData); + var rows:Array = lines.filter(function(line) return line != ""); + csvData.replace("\n", ','); + + var heightInTiles = rows.length; + var widthInTiles = 0; + + var row:Int = 0; + + // LMAOOOO STOLE ALL THIS FROM FLXBASETILEMAP LOLOL + + var dopeArray:Array = []; + while (row < heightInTiles) + { + var rowString = rows[row]; + if (rowString.endsWith(",")) + rowString = rowString.substr(0, rowString.length - 1); + var columns = rowString.split(","); + + if (columns.length == 0) + { + heightInTiles--; + continue; + } + if (widthInTiles == 0) + { + widthInTiles = columns.length; + } + + var column = 0; + var pushedInColumn:Bool = false; + while (column < widthInTiles) + { + // the current tile to be added: + var columnString = columns[column]; + var curTile = Std.parseInt(columnString); + + if (curTile == null) + throw 'String in row $row, column $column is not a valid integer: "$columnString"'; + + if (curTile == 1) + { + if (column < 4) + dopeArray.push(column + 1); + else + { + var tempCol = (column + 1) * -1; + tempCol += 4; + dopeArray.push(tempCol); + } + + pushedInColumn = true; + } + + column++; + } + + if (!pushedInColumn) + dopeArray.push(0); + + row++; + } + + trace(dopeArray.length); + trace(dopeArray); + return dopeArray; + } +} diff --git a/source/Charting.hx b/source/Charting.hx new file mode 100644 index 000000000..7c8e573cc --- /dev/null +++ b/source/Charting.hx @@ -0,0 +1,14 @@ +package; + +import flixel.FlxG; +import flixel.FlxState; + +class Charting extends FlxState +{ + override function create() + { + FlxG.sound.music.stop(); + + super.create(); + } +} diff --git a/source/Main.hx b/source/Main.hx index efa0e2d46..a4040a187 100644 --- a/source/Main.hx +++ b/source/Main.hx @@ -1,6 +1,7 @@ package; import flixel.FlxGame; +import openfl.display.FPS; import openfl.display.Sprite; class Main extends Sprite @@ -9,5 +10,9 @@ class Main extends Sprite { super(); addChild(new FlxGame(0, 0, PlayState)); + + #if !mobile + addChild(new FPS(10, 3, 0xFFFFFF)); + #end } } diff --git a/source/Note.hx b/source/Note.hx index 43328e312..cc29980e0 100644 --- a/source/Note.hx +++ b/source/Note.hx @@ -1,6 +1,7 @@ package; import flixel.FlxSprite; +import flixel.graphics.frames.FlxAtlasFrames; import flixel.util.FlxColor; class Note extends FlxSprite @@ -25,7 +26,9 @@ class Note extends FlxSprite this.noteData = noteData; - makeGraphic(50, 50); + var tex = FlxAtlasFrames.fromSparrow(AssetPaths.NOTE_assets__png, AssetPaths.NOTE_assets__xml); + frames = tex; + var swagWidth:Float = 55; switch (Math.abs(noteData)) @@ -69,9 +72,19 @@ class Note extends FlxSprite tooLate = true; } else + { canBeHit = false; - if (tooLate && alpha > 0.3) - alpha *= 0.3; + if (strumTime <= Conductor.songPosition) + { + wasGoodHit = true; + } + } + + if (tooLate) + { + if (alpha > 0.3) + alpha = 0.3; + } } } diff --git a/source/PlayState.hx b/source/PlayState.hx index e252acfb1..b02666a67 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -1,24 +1,33 @@ package; import flixel.FlxG; +import flixel.FlxObject; import flixel.FlxSprite; import flixel.FlxState; +import flixel.graphics.frames.FlxAtlasFrames; import flixel.group.FlxGroup.FlxTypedGroup; import flixel.system.FlxSound; import flixel.text.FlxText; import flixel.tweens.FlxTween; +import flixel.util.FlxCollision; +import flixel.util.FlxColor; +import flixel.util.FlxStringUtil; import flixel.util.FlxTimer; import haxe.Json; import lime.utils.Assets; +using StringTools; + class PlayState extends FlxState { private var lastBeat:Float = 0; private var lastStep:Float = 0; + private var vocals:FlxSound; private var canHit:Bool = false; private var totalBeats:Int = 0; + private var totalSteps:Int = 0; private var canHitText:FlxText; @@ -32,21 +41,48 @@ class PlayState extends FlxState private var sectionScores:Array = [[], []]; + private var camFollow:FlxObject; + override public function create() { dad = new FlxSprite(100, 100).loadGraphic(AssetPaths.DADDY_DEAREST__png); + var dadTex = FlxAtlasFrames.fromSparrow(AssetPaths.DADDY_DEAREST__png, AssetPaths.DADDY_DEAREST__xml); + dad.frames = dadTex; + dad.animation.addByPrefix('idle', 'Dad idle dance', 24); + dad.animation.addByPrefix('singUP', 'Dad Sing note UP', 24); + dad.animation.addByPrefix('singRIGHT', 'Dad Sing note UP', 24); + dad.animation.addByPrefix('singDOWN', 'Dad Sing Note DOWN', 24); + dad.animation.addByPrefix('singLEFT', 'dad sing note right', 24); + dad.animation.play('idle'); add(dad); - boyfriend = new FlxSprite(470, 100).loadGraphic(AssetPaths.BOYFRIEND__png); + boyfriend = new FlxSprite(770, 450); + var tex = FlxAtlasFrames.fromSparrow(AssetPaths.BOYFRIEND__png, AssetPaths.BOYFRIEND__xml); + boyfriend.frames = tex; + boyfriend.animation.addByPrefix('idle', 'BF idle dance', 24, false); + boyfriend.animation.addByPrefix('singUP', 'BF NOTE UP', 24, false); + boyfriend.animation.addByPrefix('singLEFT', 'BF NOTE LEFT', 24, false); + boyfriend.animation.addByPrefix('singRIGHT', 'BF NOTE RIGHT', 24, false); + boyfriend.animation.addByPrefix('singDOWN', 'BF NOTE DOWN', 24, false); + boyfriend.animation.addByPrefix('hey', 'BF HEY', 24, false); + boyfriend.animation.play('idle'); add(boyfriend); - generateSong('assets/data/bopeebo.json'); + generateSong('assets/data/bopeebo/bopeebo.json'); canHitText = new FlxText(10, 10, 0, "weed"); strumLine = new FlxSprite(0, 50).makeGraphic(FlxG.width, 10); + strumLine.scrollFactor.set(); add(strumLine); + camFollow = new FlxObject(0, 0, 1, 1); + add(camFollow); + + FlxG.camera.follow(camFollow, LOCKON, 0.04); + // FlxG.camera.setScrollBounds(0, FlxG.width, 0, FlxG.height); + FlxG.camera.zoom = 1.05; + FlxG.worldBounds.set(0, 0, FlxG.width, FlxG.height); super.create(); @@ -56,13 +92,25 @@ class PlayState extends FlxState private function generateSong(dataPath:String):Void { + // FlxG.log.add(ChartParser.parse()); + var songData = Json.parse(Assets.getText(dataPath)); - FlxG.sound.playMusic("assets/music/" + songData.song + ".mp3"); + FlxG.sound.playMusic("assets/music/" + songData.song + "_Inst.mp3"); + + vocals = new FlxSound().loadEmbedded("assets/music/" + songData.song + "_Voices.mp3"); + FlxG.sound.list.add(vocals); + vocals.play(); notes = new FlxTypedGroup(); add(notes); - var noteData:Array = songData.data; + var noteData:Array = []; + + for (i in 1...songData.sections + 1) + { + trace(i); + noteData.push(ChartParser.parse(songData.song.toLowerCase(), i)); + } var playerCounter:Int = 0; @@ -86,6 +134,7 @@ class PlayState extends FlxState + ((Conductor.crochet * 4) * playerCounter)); var swagNote:Note = new Note(daStrumTime, songNotes); + swagNote.scrollFactor.set(0, 0); swagNote.x += ((FlxG.width / 2) * playerCounter); // general offset @@ -116,14 +165,15 @@ class PlayState extends FlxState } } - var bouncingSprite:FlxSprite; - var sectionScored:Bool = false; override public function update(elapsed:Float) { super.update(elapsed); + if (FlxG.keys.justPressed.NINE) + FlxG.switchState(new Charting()); + Conductor.songPosition = FlxG.sound.music.time; var playerTurn:Int = totalBeats % 8; @@ -133,29 +183,65 @@ class PlayState extends FlxState sectionScored = true; } + if (playerTurn == 0) + { + camFollow.setPosition(dad.getGraphicMidpoint().x + 150, dad.getGraphicMidpoint().y - 100); + vocals.volume = 1; + } + + if (playerTurn == 4) + { + camFollow.setPosition(boyfriend.getGraphicMidpoint().x - 100, boyfriend.getGraphicMidpoint().y - 100); + } + if (playerTurn < 4) { - bouncingSprite = dad; sectionScored = false; } - else - bouncingSprite = boyfriend; - - if (bouncingSprite.scale.x < 1) - { - bouncingSprite.setGraphicSize(Std.int(bouncingSprite.width + (FlxG.elapsed * 2))); - } - - canHitText.visible = canHit; - canHitText.text = 'WWEED' + debugNum; FlxG.watch.addQuick("beatShit", playerTurn); everyBeat(); everyStep(); - notes.forEach(function(daNote:Note) + notes.forEachAlive(function(daNote:Note) { + if (daNote.y > FlxG.height) + { + daNote.active = false; + daNote.visible = false; + } + else + { + daNote.visible = true; + daNote.active = true; + } + + if (daNote.y < -daNote.height) + { + if (daNote.tooLate) + vocals.volume = 0; + + daNote.kill(); + } + + if (!daNote.mustPress && daNote.wasGoodHit) + { + switch (Math.abs(daNote.noteData)) + { + case 1: + dad.animation.play('singUP'); + case 2: + dad.animation.play('singRIGHT'); + case 3: + dad.animation.play('singDOWN'); + case 4: + dad.animation.play('singLEFT'); + } + + daNote.kill(); + } + daNote.y = (strumLine.y + 5 - (daNote.height / 2)) - ((Conductor.songPosition - daNote.strumTime) * 0.4); }); @@ -164,6 +250,9 @@ class PlayState extends FlxState private function popUpScore():Void { + boyfriend.animation.play('hey'); + vocals.volume = 1; + var placement:String = sectionScores[1][curSection] + '/' + sectionScores[0][curSection]; var coolText:FlxText = new FlxText(0, 0, 0, placement, 32); coolText.screenCenter(); @@ -242,8 +331,21 @@ class PlayState extends FlxState { if (!note.wasGoodHit) { + switch (Math.abs(note.noteData)) + { + case 1: + boyfriend.animation.play('singUP'); + case 2: + boyfriend.animation.play('singRIGHT'); + case 3: + boyfriend.animation.play('singDOWN'); + case 4: + boyfriend.animation.play('singLEFT'); + } + sectionScores[1][curSection] += note.noteScore; note.wasGoodHit = true; + vocals.volume = 1; } } @@ -259,7 +361,10 @@ class PlayState extends FlxState totalBeats += 1; - bouncingSprite.setGraphicSize(Std.int(bouncingSprite.width * 0.9)); + dad.animation.play('idle'); + + if (!boyfriend.animation.curAnim.name.startsWith("sing")) + boyfriend.animation.play('idle'); } } } @@ -273,6 +378,7 @@ class PlayState extends FlxState if (Conductor.songPosition > lastStep + Conductor.stepCrochet) { + totalSteps += 1; lastStep += Conductor.stepCrochet; canHitText.text += "\nWEED\nWEED"; }