pico note sort

This commit is contained in:
Cameron Taylor 2021-03-30 21:25:41 -07:00
parent 82d0490f16
commit 4518cbfbbc
2 changed files with 16 additions and 2 deletions

View File

@ -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<Dynamic>, val2:Array<Dynamic>):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);

View File

@ -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);