diff --git a/source/funkin/game/Character.hx b/source/funkin/game/Character.hx index 169fc31a..88cec130 100644 --- a/source/funkin/game/Character.hx +++ b/source/funkin/game/Character.hx @@ -239,6 +239,19 @@ class Character extends FlxSprite implements IBeatReceiver implements IOffsetCom } } + public function tryDance() { + switch(lastAnimContext) { + case SING | MISS: + if (lastHit + (Conductor.stepCrochet * holdTime) < Conductor.songPosition) + dance(); + case DANCE: + dance(); + default: + if (animation.curAnim == null || animation.curAnim.finished) + dance(); + } + } + /** * Whenever the character should dance on beat or not. Set to false for `gf`, since the dance animation is automatically handled by PlayState. */ @@ -247,16 +260,7 @@ class Character extends FlxSprite implements IBeatReceiver implements IOffsetCom public function beatHit(curBeat:Int) { script.call("beatHit", [curBeat]); if (danceOnBeat) { - switch(lastAnimContext) { - case SING | MISS: - if (lastHit + (Conductor.stepCrochet * holdTime) < Conductor.songPosition) - dance(); - case DANCE: - dance(); - default: - if (animation.curAnim == null || animation.curAnim.finished) - dance(); - } + tryDance(); } } diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index 66666854..9f7ab2a9 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -1657,9 +1657,7 @@ class PlayState extends MusicBeatState iconP2.updateHitbox(); if (gf != null && curBeat % gfSpeed == 0) - { - gf.dance(); - } + gf.tryDance(); scripts.call("beatHit", [curBeat]); }