DEADSOFTWARE

Minor changes
authorfred-boy <fred-boy@protonmail.com>
Mon, 10 Sep 2018 11:47:50 +0000 (18:47 +0700)
committerfred-boy <fred-boy@protonmail.com>
Mon, 10 Sep 2018 11:47:50 +0000 (18:47 +0700)
core/src/ru/deadsoftware/cavecraft/game/GameRenderer.java
core/src/ru/deadsoftware/cavecraft/game/mobs/Pig.java

index fac4ba2a9f25d42c987e1c6d68e1adaa33d38562..93618f20b0b4aa0e9fae23ae8ef2f565440d46ba 100644 (file)
@@ -174,9 +174,8 @@ public class GameRenderer extends Renderer {
 
     private void drawGamePlay() {
         drawWorldBackground();
-        //Mob.animateMobs();
-        for (Mob mob : gameProc.mobs) drawMob(mob);
         drawPlayer(gameProc.player);
+        for (Mob mob : gameProc.mobs) drawMob(mob);
         drawWorldForeground();
         drawGUI();
     }
index 44333ab18a774d572a0225d3dd3cf56de0e5380a..04a96f6b7d41ad9ced14bc919e584de9ee69f815 100644 (file)
@@ -25,14 +25,15 @@ public class Pig extends Mob{
     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;