From 853820c56b2f31d5775b587afe639e991f096aaf Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Mon, 30 May 2022 23:59:12 -0400 Subject: [PATCH] animation timing fixes --- source/funkin/play/character/BaseCharacter.hx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/source/funkin/play/character/BaseCharacter.hx b/source/funkin/play/character/BaseCharacter.hx index 3f038e294..22b95bc06 100644 --- a/source/funkin/play/character/BaseCharacter.hx +++ b/source/funkin/play/character/BaseCharacter.hx @@ -207,7 +207,7 @@ class BaseCharacter extends Bopper super.onUpdate(event); // Reset hold timer for each note pressed. - if (justPressedNote()) + if (justPressedNote() && this.characterType == BF) { holdTimer = 0; } @@ -233,12 +233,16 @@ class BaseCharacter extends Bopper { holdTimer += event.elapsed; var singTimeMs:Float = singTimeCrochet * (Conductor.crochet * 0.001); // x beats, to ms. + + if (getCurrentAnimation().endsWith("miss")) + singTimeMs *= 2; // makes it feel more awkward when you miss + // Without this check here, the player character would only play the `sing` animation // for one beat, as opposed to holding it as long as the player is holding the button. var shouldStopSinging:Bool = (this.characterType == BF) ? !isHoldingNote() : true; FlxG.watch.addQuick('singTimeMs-${characterId}', singTimeMs); - if (holdTimer > singTimeMs && shouldStopSinging && !getCurrentAnimation().endsWith("miss")) + if (holdTimer > singTimeMs && shouldStopSinging) { trace(getCurrentAnimation()); // trace('holdTimer reached ${holdTimer}sec (> ${singTimeMs}), stopping sing animation'); @@ -358,17 +362,17 @@ class BaseCharacter extends Bopper { super.onNoteHit(event); - holdTimer = 0; - if (event.note.mustPress && characterType == BF) { // If the note is from the same strumline, play the sing animation. this.playSingAnimation(event.note.data.dir, false, event.note.data.altNote); + holdTimer = 0; } else if (!event.note.mustPress && characterType == DAD) { // If the note is from the same strumline, play the sing animation. this.playSingAnimation(event.note.data.dir, false, event.note.data.altNote); + holdTimer = 0; } }