pico note sort

This commit is contained in:
Cameron Taylor 2021-03-30 21:25:41 -07:00
parent 60e3facc22
commit bd771261e1
2 changed files with 16 additions and 2 deletions

View file

@ -5,6 +5,7 @@ import flixel.FlxG;
import flixel.FlxSprite; import flixel.FlxSprite;
import flixel.animation.FlxBaseAnimation; import flixel.animation.FlxBaseAnimation;
import flixel.graphics.frames.FlxAtlasFrames; import flixel.graphics.frames.FlxAtlasFrames;
import flixel.util.FlxSort;
import haxe.io.Path; import haxe.io.Path;
using StringTools; using StringTools;
@ -504,6 +505,12 @@ class Character extends FlxSprite
TankmenBG.animationNotes = animationNotes; TankmenBG.animationNotes = animationNotes;
trace(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) function quickAnimAdd(name:String, prefix:String)
@ -573,6 +580,11 @@ class Character extends FlxSprite
animationNotes.shift(); animationNotes.shift();
} }
} }
if (animation.curAnim.finished)
{
playAnim(animation.curAnim.name, false, false, animation.curAnim.numFrames - 3);
}
} }
super.update(elapsed); 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))); 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) && daNote.y - daNote.offset.y * daNote.scale.y + daNote.height >= strumLineMid)
{ {
// div by scale because cliprect is affected by scale i THINK // 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))); 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) && 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); var swagRect:FlxRect = new FlxRect(0, 0, daNote.width / daNote.scale.x, daNote.height / daNote.scale.y);