DEADSOFTWARE

Fix swimming
[cavedroid.git] / core / src / ru / deadsoftware / cavedroid / game / mobs / Pig.java
index b362da73a38f6d831aa1fa54b9f2a2e6a9679a58..15185ef1b8319311aead7f8f74c675a73a0b14f0 100644 (file)
@@ -3,7 +3,7 @@ package ru.deadsoftware.cavedroid.game.mobs;
 import com.badlogic.gdx.graphics.g2d.SpriteBatch;
 import com.badlogic.gdx.math.MathUtils;
 import com.badlogic.gdx.math.Vector2;
-import ru.deadsoftware.cavedroid.game.GameWorld;
+import ru.deadsoftware.cavedroid.game.world.GameWorld;
 import ru.deadsoftware.cavedroid.misc.Assets;
 
 import static ru.deadsoftware.cavedroid.misc.Assets.pigSprite;
@@ -12,27 +12,27 @@ public class Pig extends Mob {
 
     public Pig(float x, float y) {
         super(x, y, 25, 18, randomDir(), Type.MOB);
-        mMove = new Vector2(looksLeft() ? -1 : 1, 0);
+        mVelocity = new Vector2(looksLeft() ? -1 : 1, 0);
     }
 
     @Override
     public void changeDir() {
         switchDir();
-        mMove.x = -1 + 2 * dirMultiplier();
+        mVelocity.x = -1 + 2 * dirMultiplier();
     }
 
     @Override
-    public void ai(GameWorld gameWorld) {
+    public void ai(GameWorld gameWorld, float delta) {
         if (MathUtils.randomBoolean(.0025f)) {
-            if (mMove.x != 0f) {
-                mMove.x = 0;
+            if (mVelocity.x != 0f) {
+                mVelocity.x = 0;
             } else {
                 changeDir();
             }
         }
 
-        if (mMove.x != 0f) {
-            mAnim += mAnimDelta;
+        if (mVelocity.x != 0f) {
+            mAnim += mAnimDelta * delta;
         } else {
             mAnim = 0;
         }
@@ -43,7 +43,7 @@ public class Pig extends Mob {
     }
 
     @Override
-    public void draw(SpriteBatch spriteBatch, float x, float y) {
+    public void draw(SpriteBatch spriteBatch, float x, float y, float delta) {
         pigSprite[0][1].setRotation(getAnim());
         pigSprite[1][1].setRotation(-getAnim());
         //back legs