From 7bd07c5544488066e1d940305f1da53138859545 Mon Sep 17 00:00:00 2001 From: fredboy Date: Mon, 15 Apr 2024 23:57:55 +0700 Subject: [PATCH] Maybe fix animation --- .../ru/deadsoftware/cavedroid/game/mobs/Player.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/core/src/ru/deadsoftware/cavedroid/game/mobs/Player.java b/core/src/ru/deadsoftware/cavedroid/game/mobs/Player.java index 5ea56d9..3335b7f 100644 --- a/core/src/ru/deadsoftware/cavedroid/game/mobs/Player.java +++ b/core/src/ru/deadsoftware/cavedroid/game/mobs/Player.java @@ -72,7 +72,15 @@ public class Player extends Mob { Assets.playerSprite[0][3].setRotation(-mAnim); Assets.playerSprite[1][3].setRotation(mAnim); - if (mAnim >= 60 || mAnim <= -60 ||(mVelocity.x == 0f && isAnimationIncreasing())) { + if (mAnim > 60f) { + mAnim = 60f; + mAnimDelta = -ANIMATION_SPEED; + } else if (mAnim < -60f) { + mAnim = -60f; + mAnimDelta = ANIMATION_SPEED; + } + + if (mVelocity.x == 0f && isAnimationIncreasing()) { mAnimDelta = -mAnimDelta; } -- 2.29.2