Try to fix the characters dancing fast?

This commit is contained in:
Ralty
2025-07-05 18:20:21 +07:00
parent 2b533d62f5
commit a5c208f4d3
2 changed files with 6 additions and 4 deletions
+3 -2
View File
@@ -15,6 +15,7 @@ import flixel.math.FlxRect;
import flixel.math.FlxPoint;
import flixel.util.typeLimit.OneOfTwo;
import funkin.backend.system.interfaces.IBeatReceiver;
import funkin.backend.system.Conductor;
enum abstract XMLAnimType(Int)
{
@@ -140,9 +141,9 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I
private var countedBeat = 0;
public function beatHit(curBeat:Int)
{
if (beatAnims.length > 0 && (curBeat + beatOffset) % beatInterval == 0)
if (Conductor.curBeat != curBeat || (skipNegativeBeats && curBeat < 0)) return;
if (beatAnims.length > 0 && (curBeat + beatOffset - Conductor.lastBeatChange) % (beatInterval * CoolUtil.minInt(Math.floor(4 / Conductor.stepsPerBeat), 1)) == 0)
{
if(skipNegativeBeats && curBeat < 0) return;
// TODO: find a solution without countedBeat
var anim = beatAnims[FlxMath.wrap(countedBeat++, 0, beatAnims.length - 1)];
if (anim.name != null && anim.name != "null" && anim.name != "none")
+3 -2
View File
@@ -167,13 +167,14 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset
}
/**
* Whenever the character should dance on beat or not. Set to false for `gf`, since the dance animation is automatically handled by PlayState.
* Whenever the character should dance on beat or not.
*/
public var danceOnBeat:Bool = true;
public override function beatHit(curBeat:Int) {
scripts.call("beatHit", [curBeat]);
if (danceOnBeat && (curBeat + beatOffset) % beatInterval == 0 && !__lockAnimThisFrame)
if (Conductor.curBeat != curBeat || (skipNegativeBeats && curBeat < 0)) return;
if (danceOnBeat && (curBeat + beatOffset - Conductor.lastBeatChange) % (beatInterval * CoolUtil.minInt(Math.floor(4 / Conductor.stepsPerBeat), 1)) == 0 && !__lockAnimThisFrame)
tryDance();
}