From bd771261e123e1c125a45175765f9a096938a928 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Tue, 30 Mar 2021 21:25:41 -0700 Subject: [PATCH] pico note sort --- source/Character.hx | 12 ++++++++++++ source/PlayState.hx | 6 ++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/source/Character.hx b/source/Character.hx index 3e203e61d..06745f3b3 100644 --- a/source/Character.hx +++ b/source/Character.hx @@ -5,6 +5,7 @@ import flixel.FlxG; import flixel.FlxSprite; import flixel.animation.FlxBaseAnimation; import flixel.graphics.frames.FlxAtlasFrames; +import flixel.util.FlxSort; import haxe.io.Path; using StringTools; @@ -504,6 +505,12 @@ class Character extends FlxSprite TankmenBG.animationNotes = animationNotes; trace(animationNotes); + animationNotes.sort(sortAnims); + } + + function sortAnims(val1:Array, val2:Array):Int + { + return FlxSort.byValues(FlxSort.ASCENDING, val1[0], val2[0]); } function quickAnimAdd(name:String, prefix:String) @@ -573,6 +580,11 @@ class Character extends FlxSprite animationNotes.shift(); } } + + if (animation.curAnim.finished) + { + playAnim(animation.curAnim.name, false, false, animation.curAnim.numFrames - 3); + } } super.update(elapsed); diff --git a/source/PlayState.hx b/source/PlayState.hx index 6565c4eb1..f3bf44cca 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -1653,7 +1653,8 @@ class PlayState extends MusicBeatState { daNote.y = (strumLine.y + (Conductor.songPosition - daNote.strumTime) * (0.45 * FlxMath.roundDecimal(SONG.speed, 2))); - if (daNote.isSustainNote && (!daNote.mustPress || (daNote.wasGoodHit || (daNote.prevNote.wasGoodHit && !daNote.canBeHit))) + if (daNote.isSustainNote + && (!daNote.mustPress || (daNote.wasGoodHit || (daNote.prevNote.wasGoodHit && !daNote.canBeHit))) && daNote.y - daNote.offset.y * daNote.scale.y + daNote.height >= strumLineMid) { // div by scale because cliprect is affected by scale i THINK @@ -1667,7 +1668,8 @@ class PlayState extends MusicBeatState { daNote.y = (strumLine.y - (Conductor.songPosition - daNote.strumTime) * (0.45 * FlxMath.roundDecimal(SONG.speed, 2))); - if (daNote.isSustainNote && (!daNote.mustPress || (daNote.wasGoodHit || (daNote.prevNote.wasGoodHit && !daNote.canBeHit))) + if (daNote.isSustainNote + && (!daNote.mustPress || (daNote.wasGoodHit || (daNote.prevNote.wasGoodHit && !daNote.canBeHit))) && daNote.y + daNote.offset.y * daNote.scale.y <= strumLineMid) { var swagRect:FlxRect = new FlxRect(0, 0, daNote.width / daNote.scale.x, daNote.height / daNote.scale.y);