1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-28 18:02:46 +00:00

animation timing fixes

This commit is contained in:
Cameron Taylor 2022-05-30 23:59:12 -04:00
parent 64b40ce7b8
commit 853820c56b

View file

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