diff --git a/core/src/ru/deadsoftware/cavecraft/game/mobs/Pig.java b/core/src/ru/deadsoftware/cavecraft/game/mobs/Pig.java
index 879b66760cc082b0c0ee751f651da49092a22931..aaa301998beeb1130f215f4447486cbcb6e23f33 100644 (file)
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;
+import ru.deadsoftware.cavecraft.game.GameWorld;
import ru.deadsoftware.cavecraft.misc.Assets;
import ru.deadsoftware.cavecraft.game.GameProc;
public class Pig extends Mob{
- private GameProc gameProc;
-
- public Pig(int x, int y, GameProc gameProc) {
- this.gameProc = gameProc;
+ public Pig(int x, int y) {
position = new Vector2(x, y);
moveX = new Vector2(0, 0);
moveY = new Vector2(0, 0);
height = 18;
dir = 0;
canJump = false;
+ agressive = false;
}
@Override
public void ai() {
- if (canJump && position.x>16 && position.x<(gameProc.world.getWidth()-1)*16 &&
- gameProc.world.getForeMap((int)(position.x/16)+(dir*2-1), (int)((position.y+height)/16))>0 &&
- gameProc.world.getForeMap((int)(position.x/16)+(dir*2-1), (int)((position.y)/16))==0)
- moveY.add(0, -8);
- if (MathUtils.randomBoolean(.0001f)) dir++;
- if (dir>1) dir = 0;
- moveX.set(-1.5f+3*dir,0);
+ if (MathUtils.randomBoolean(.0025f)) dir=-dir+1;
+ moveX.set(-1+2*dir,0);
}
@Override