diff --git a/source/Boyfriend.hx b/source/Boyfriend.hx index 0dc9c72c6..51af857e7 100644 --- a/source/Boyfriend.hx +++ b/source/Boyfriend.hx @@ -20,16 +20,11 @@ class Boyfriend extends Character animation.addByPrefix('hey', 'BF HEY', 24, false); playAnim('idle'); - addOffset('idle'); - addOffset("singUP", -28, 27); + addOffset('idle', -5); + addOffset("singUP", -29, 27); addOffset("singRIGHT", -38, -7); addOffset("singLEFT", 12, -6); - addOffset("singDOWN", -14, -50); - addOffset("hey", 1, 6); - } - - override function update(elapsed:Float) - { - super.update(elapsed); + addOffset("singDOWN", -10, -50); + addOffset("hey", 7, 4); } } diff --git a/source/ChartParser.hx b/source/ChartParser.hx index 46b15743e..e6161da02 100644 --- a/source/ChartParser.hx +++ b/source/ChartParser.hx @@ -11,7 +11,7 @@ class ChartParser 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 csvData = FlxStringUtil.imageToCSV('assets/data/' + songName + '/' + songName + '_section' + section + '.png'); var lines:Array = regex.split(csvData); var rows:Array = lines.filter(function(line) return line != ""); diff --git a/source/Charting.hx b/source/Charting.hx index 9aad403e1..a637847f4 100644 --- a/source/Charting.hx +++ b/source/Charting.hx @@ -7,6 +7,7 @@ import flixel.FlxState; import flixel.addons.display.FlxGridOverlay; import flixel.group.FlxGroup.FlxTypedGroup; import flixel.text.FlxText; +import flixel.util.FlxColor; /** *DEBUG MODE @@ -83,6 +84,7 @@ class Charting extends FlxState { var text:FlxText = new FlxText(10, 20 + (18 * daLoop), 0, anim + ": " + offsets, 15); text.scrollFactor.set(); + text.color = FlxColor.BLUE; dumbTexts.add(text); if (pushList) diff --git a/source/Conductor.hx b/source/Conductor.hx index c0e2eb87e..f1e3d4c77 100644 --- a/source/Conductor.hx +++ b/source/Conductor.hx @@ -16,4 +16,12 @@ class Conductor public static var safeZoneOffset:Float = (safeFrames / 60) * 1000; // is calculated in create(), is safeFrames in milliseconds public function new() {} + + public static function changeBPM(newBpm:Int) + { + bpm = newBpm; + + crochet = ((60 / bpm) * 1000); + stepCrochet = crochet / 4; + } } diff --git a/source/Dad.hx b/source/Dad.hx index 25641838b..d6351d995 100644 --- a/source/Dad.hx +++ b/source/Dad.hx @@ -11,14 +11,14 @@ class Dad extends Character frames = dadTex; animation.addByPrefix('idle', 'Dad idle dance', 24); animation.addByPrefix('singUP', 'Dad Sing Note UP', 24); - animation.addByPrefix('singRIGHT', 'Dad Sing Note UP', 24); + animation.addByPrefix('singRIGHT', 'Dad Sing Note RIGHT', 24); animation.addByPrefix('singDOWN', 'Dad Sing Note DOWN', 24); - animation.addByPrefix('singLEFT', 'Dad Sing Note RIGHT', 24); + animation.addByPrefix('singLEFT', 'Dad Sing Note LEFT', 24); playAnim('idle'); addOffset('idle'); addOffset("singUP", -6, 50); - addOffset("singRIGHT", -6, 50); + addOffset("singRIGHT", 0, 27); addOffset("singLEFT", -10, 10); addOffset("singDOWN", 0, -30); } diff --git a/source/PlayState.hx b/source/PlayState.hx index d190e8e19..9ee2e0916 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -42,6 +42,7 @@ class PlayState extends FlxState private var curSection:Int = 0; private var sectionScores:Array = [[], []]; + private var sectionLengths:Array = []; private var camFollow:FlxObject; private var strumLineNotes:FlxTypedGroup; @@ -68,7 +69,7 @@ class PlayState extends FlxState playerStrums = new FlxTypedGroup(); - generateSong('assets/data/bopeebo/bopeebo.json'); + generateSong('assets/data/fresh/fresh.json'); canHitText = new FlxText(10, 10, 0, "weed"); @@ -98,6 +99,7 @@ class PlayState extends FlxState generateStaticArrows(1); var songData = Json.parse(Assets.getText(dataPath)); + Conductor.changeBPM(songData.bpm); FlxG.sound.playMusic("assets/music/" + songData.song + "_Inst.mp3"); vocals = new FlxSound().loadEmbedded("assets/music/" + songData.song + "_Voices.mp3"); @@ -119,21 +121,32 @@ class PlayState extends FlxState while (playerCounter < 2) { var daBeats:Int = 0; // Not exactly representative of 'daBeats' lol, just how much it has looped + var totalLength:Int = 0; // Total length of the song, in beats; for (section in noteData) { var dumbassSection:Array = section; var daStep:Int = 0; + var coolSection:Int = Std.int(section.length / 4); + + if (coolSection <= 4) // FIX SINCE MOST THE SHIT I MADE WERE ONLY 3 HTINGS LONG LOl + coolSection = 4; + else if (coolSection <= 8) + coolSection = 8; for (songNotes in dumbassSection) { sectionScores[0].push(0); sectionScores[1].push(0); + trace('SECTON'); + trace(daBeats); + trace(totalLength); + if (songNotes != 0) { - var daStrumTime:Float = (((daStep * Conductor.stepCrochet) + (Conductor.crochet * 8 * daBeats)) - + ((Conductor.crochet * 4) * playerCounter)); + var daStrumTime:Float = ((daStep * Conductor.stepCrochet) + (Conductor.crochet * 8 * totalLength)) + + ((Conductor.crochet * coolSection) * playerCounter); var swagNote:Note = new Note(daStrumTime, songNotes); swagNote.scrollFactor.set(0, 0); @@ -160,11 +173,16 @@ class PlayState extends FlxState daStep += 1; } + // only need to do it once + if (playerCounter == 0) + sectionLengths.push(Math.round(coolSection / 4)); + totalLength += Math.round(coolSection / 4); daBeats += 1; } playerCounter += 1; } + trace(sectionLengths); } private function generateStaticArrows(player:Int):Void @@ -237,9 +255,9 @@ class PlayState extends FlxState FlxG.switchState(new Charting(true)); Conductor.songPosition = FlxG.sound.music.time; - var playerTurn:Int = totalBeats % 8; + var playerTurn:Int = totalBeats % (sectionLengths[curSection] * 8); - if (playerTurn == 7 && !sectionScored) + if (playerTurn == (sectionLengths[curSection] * 8) - 1 && !sectionScored) { popUpScore(); sectionScored = true; @@ -251,7 +269,7 @@ class PlayState extends FlxState vocals.volume = 1; } - if (playerTurn == 4) + if (playerTurn == Std.int((sectionLengths[curSection] * 8) / 2)) { camFollow.setPosition(boyfriend.getGraphicMidpoint().x - 100, boyfriend.getGraphicMidpoint().y - 100); }