DEADSOFTWARE

Fix hitting animation
[cavedroid.git] / core / src / ru / deadsoftware / cavedroid / game / mobs / Player.java
index ebdd9c0dbed6281204809267f6ed0997f270925b..49c59ee2e8eaae923627e7b81367d63e84778dcb 100644 (file)
@@ -26,13 +26,12 @@ public class Player extends Mob {
 
     public final int[] inventory;
     public int slot;
-    public final int gameMode;
+    public int gameMode;
     public boolean swim;
     public float headRotation = 0f;
 
     public Player() {
         super(0, 0, 4, 30, randomDir(), Type.MOB, MAX_HEALTH);
-        this.gameMode = 1;
         inventory = new int[9];
         swim = false;
     }
@@ -174,6 +173,7 @@ public class Player extends Mob {
 
         if (hitAnim < 30f || hitAnim > 90f) {
             if (hitting) {
+                hitAnim = MathUtils.clamp(hitAnim, 30f, 90f);
                 hitAnimDelta = -hitAnimDelta;
             } else  {
                 hitAnimDelta = ANIMATION_SPEED;