This commit is contained in:
Yoshman29
2022-12-28 17:32:15 +01:00
parent 5277b9c7a1
commit cf1ad42cc7
2 changed files with 15 additions and 13 deletions
+14 -10
View File
@@ -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();
}
}
+1 -3
View File
@@ -1657,9 +1657,7 @@ class PlayState extends MusicBeatState
iconP2.updateHitbox();
if (gf != null && curBeat % gfSpeed == 0)
{
gf.dance();
}
gf.tryDance();
scripts.call("beatHit", [curBeat]);
}