DEADSOFTWARE

Maybe fix animation
authorfredboy <fredboy@protonmail.com>
Mon, 15 Apr 2024 16:57:55 +0000 (23:57 +0700)
committerfredboy <fredboy@protonmail.com>
Mon, 15 Apr 2024 17:10:20 +0000 (00:10 +0700)
core/src/ru/deadsoftware/cavedroid/game/mobs/Player.java

index 5ea56d9bf8c9b30cbf1d72254b02497473fe8f57..3335b7f5ebc69322478b8e1eeb7cf82f043b2baa 100644 (file)
@@ -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;
         }