DEADSOFTWARE

Minor changes
[cavedroid.git] / core / src / ru / deadsoftware / cavecraft / game / mobs / Pig.java
index 10c4242429f221641c1e0ec501545b1311127350..04a96f6b7d41ad9ced14bc919e584de9ee69f815 100644 (file)
@@ -18,21 +18,22 @@ public class Pig extends Mob{
         width = 25;
         height = 18;
         canJump = false;
-        agressive = false;
+        dead = false;
     }
 
     @Override
     public void changeDir() {
         dir=-dir+1;
         moveX.set(-1+2*dir,0);
-        if (MathUtils.randomBoolean(.0025f)) {
-            moveX.set(0, 0);
-        }
     }
 
     @Override
     public void ai() {
         if (MathUtils.randomBoolean(.0025f)) changeDir();
+        else if (MathUtils.randomBoolean(.0025f)) {
+            if (moveX.x != 0f) moveX.setZero();
+            else moveX.set(-1+2*dir, 0);
+        }
         if (moveX.x != 0f) animation+=ANIM_SPEED; else animation=0;
         if (animation>=60 || animation<=-60) {
             ANIM_SPEED = -ANIM_SPEED;
@@ -61,4 +62,10 @@ public class Pig extends Mob{
     public Rectangle getRect() {
         return new Rectangle(position.x, position.y, width, height);
     }
+
+    @Override
+    public int getType() {
+        return 0;
+    }
+
 }