From: fredboy Date: Mon, 15 Apr 2024 16:57:55 +0000 (+0700) Subject: Maybe fix animation X-Git-Tag: alpha0.4.2~12 X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=7bd07c5544488066e1d940305f1da53138859545;p=cavedroid.git Maybe fix animation --- 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; }