diff --git a/assets/images/bg.png b/assets/images/bg.png new file mode 100644 index 0000000..3b3a7bd Binary files /dev/null and b/assets/images/bg.png differ diff --git a/source/Note.hx b/source/Note.hx index f764c71..84a952b 100644 --- a/source/Note.hx +++ b/source/Note.hx @@ -19,10 +19,12 @@ class Note extends FlxSprite public static var swagWidth:Float = 160 * 0.7; - public function new(strumTime:Float, noteData:Int) + public function new(strumTime:Float, noteData:Int, prevNote:Note) { super(); + this.prevNote = prevNote; + x += 50; this.strumTime = strumTime; @@ -35,6 +37,16 @@ class Note extends FlxSprite animation.addByPrefix('blueScroll', 'blue0'); animation.addByPrefix('purpleScroll', 'purple0'); + animation.addByPrefix('purpleholdend', 'pruple end hold'); + animation.addByPrefix('greenholdend', 'green hold end'); + animation.addByPrefix('redholdend', 'red hold end'); + animation.addByPrefix('blueholdend', 'blue hold end'); + + animation.addByPrefix('purplehold', 'purple hold piece'); + animation.addByPrefix('greenhold', 'green hold piece'); + animation.addByPrefix('redhold', 'red hold piece'); + animation.addByPrefix('bluehold', 'blue hold piece'); + setGraphicSize(Std.int(width * 0.7)); updateHitbox(); antialiasing = true; @@ -55,10 +67,49 @@ class Note extends FlxSprite animation.play('purpleScroll'); } - if (noteData < 0) + trace(prevNote); + + if (noteData < 0 && prevNote != null) { noteScore * 0.2; alpha = 0.6; + + x += width / 2; + + switch (noteData) + { + case -1: + animation.play('greenholdend'); + case -2: + animation.play('redholdend'); + case -3: + animation.play('blueholdend'); + case -4: + animation.play('purpleholdend'); + } + + updateHitbox(); + + x -= width / 2; + + if (prevNote.noteData < 0) + { + switch (prevNote.noteData) + { + case -1: + prevNote.animation.play('greenhold'); + case -2: + prevNote.animation.play('redhold'); + case -3: + prevNote.animation.play('bluehold'); + case -4: + prevNote.animation.play('purplehold'); + } + + prevNote.offset.y = -19; + prevNote.scale.y *= 2.25; + // prevNote.setGraphicSize(); + } } } diff --git a/source/PlayState.hx b/source/PlayState.hx index f3888af..87d87cc 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -13,6 +13,7 @@ import flixel.text.FlxText; import flixel.tweens.FlxTween; import flixel.util.FlxCollision; import flixel.util.FlxColor; +import flixel.util.FlxSort; import flixel.util.FlxStringUtil; import flixel.util.FlxTimer; import haxe.Json; @@ -50,8 +51,11 @@ class PlayState extends FlxState override public function create() { - var bg:FlxSprite = FlxGridOverlay.create(50, 50); - bg.scrollFactor.set(0.5, 0.5); + var bg:FlxSprite = new FlxSprite(-600, -200).loadGraphic(AssetPaths.bg__png); + bg.setGraphicSize(Std.int(bg.width * 2.5)); + bg.updateHitbox(); + bg.antialiasing = true; + bg.scrollFactor.set(0.9, 0.9); add(bg); dad = new Dad(100, 100); @@ -69,7 +73,7 @@ class PlayState extends FlxState playerStrums = new FlxTypedGroup(); - generateSong('assets/data/fresh/fresh.json'); + generateSong('bopeebo'); canHitText = new FlxText(10, 10, 0, "weed"); @@ -98,7 +102,7 @@ class PlayState extends FlxState generateStaticArrows(0); generateStaticArrows(1); - var songData = Json.parse(Assets.getText(dataPath)); + var songData = Json.parse(Assets.getText('assets/data/' + dataPath + '/' + dataPath + '.json')); Conductor.changeBPM(songData.bpm); FlxG.sound.playMusic("assets/music/" + songData.song + "_Inst.mp3"); @@ -144,7 +148,13 @@ class PlayState extends FlxState var daStrumTime:Float = ((daStep * Conductor.stepCrochet) + (Conductor.crochet * 8 * totalLength)) + ((Conductor.crochet * coolSection) * playerCounter); - var swagNote:Note = new Note(daStrumTime, songNotes); + var oldNote:Note; + if (notes.members.length > 0) + oldNote = notes.members[notes.members.length - 1]; + else + oldNote = null; + + var swagNote:Note = new Note(daStrumTime, songNotes, oldNote); swagNote.scrollFactor.set(0, 0); swagNote.x += ((FlxG.width / 2) * playerCounter); // general offset @@ -158,11 +168,6 @@ class PlayState extends FlxState sectionScores[0][daBeats] += swagNote.noteScore; } - if (notes.members.length > 0) - swagNote.prevNote = notes.members[notes.members.length - 1]; - else - swagNote.prevNote = swagNote; - notes.add(swagNote); } @@ -180,6 +185,8 @@ class PlayState extends FlxState } } + var sortedNotes:Bool = false; + private function generateStaticArrows(player:Int):Void { for (i in 0...4) @@ -319,6 +326,10 @@ class PlayState extends FlxState } daNote.y = (strumLine.y - (Conductor.songPosition - daNote.strumTime) * 0.45); + + // one time sort + if (!sortedNotes) + notes.sort(FlxSort.byY, FlxSort.DESCENDING); }); } @@ -420,22 +431,22 @@ class PlayState extends FlxState switch (spr.ID) { case 1: - if (upP && spr.animation.curAnim.name != 'confirm' && !boyfriend.stunned) + if (upP && spr.animation.curAnim.name != 'confirm') spr.animation.play('pressed'); if (upR) spr.animation.play('static'); case 2: - if (rightP && spr.animation.curAnim.name != 'confirm' && !boyfriend.stunned) + if (rightP && spr.animation.curAnim.name != 'confirm') spr.animation.play('pressed'); if (rightR) spr.animation.play('static'); case 3: - if (downP && spr.animation.curAnim.name != 'confirm' && !boyfriend.stunned) + if (downP && spr.animation.curAnim.name != 'confirm') spr.animation.play('pressed'); if (downR) spr.animation.play('static'); case 4: - if (leftP && spr.animation.curAnim.name != 'confirm' && !boyfriend.stunned) + if (leftP && spr.animation.curAnim.name != 'confirm') spr.animation.play('pressed'); if (leftR) spr.animation.play('static');