From 2705ae3e166aa07e53c7ba262b0beef6c77492bc Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Thu, 2 Sep 2021 17:32:50 -0400 Subject: [PATCH] darnell looping and sustain note holding anim stuf --- source/Character.hx | 10 ++++++++++ source/PlayState.hx | 21 ++++++++++++--------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/source/Character.hx b/source/Character.hx index 96022e6ea..c48fe824d 100644 --- a/source/Character.hx +++ b/source/Character.hx @@ -500,6 +500,16 @@ class Character extends FlxSprite loadOffsetFile(curCharacter); playAnim('idle'); + + animation.finishCallback = function(animShit:String) + { + if (animShit.startsWith('sing')) + { + // loop the anim + // this way is a little verbose, but basically sets it to the same animation, but 8 frames before finish + playAnim(animShit, true, false, animation.getByName(animShit).frames.length - 8); + } + } } dance(); diff --git a/source/PlayState.hx b/source/PlayState.hx index e4c70b5b1..c0d79fbf4 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -2101,16 +2101,19 @@ class PlayState extends MusicBeatState if (daNote.altNote) altAnim = '-alt'; - switch (Math.abs(daNote.noteData)) + if (!daNote.isSustainNote) { - case 0: - dad.playAnim('singLEFT' + altAnim, true); - case 1: - dad.playAnim('singDOWN' + altAnim, true); - case 2: - dad.playAnim('singUP' + altAnim, true); - case 3: - dad.playAnim('singRIGHT' + altAnim, true); + switch (Math.abs(daNote.noteData)) + { + case 0: + dad.playAnim('singLEFT' + altAnim, true); + case 1: + dad.playAnim('singDOWN' + altAnim, true); + case 2: + dad.playAnim('singUP' + altAnim, true); + case 3: + dad.playAnim('singRIGHT' + altAnim, true); + } } dad.holdTimer = 0;