summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 35747c2)
raw | patch | inline | side by side (parent: 35747c2)
author | fred-boy <fred-boy@protonmail.com> | |
Mon, 10 Sep 2018 11:47:50 +0000 (18:47 +0700) | ||
committer | fred-boy <fred-boy@protonmail.com> | |
Mon, 10 Sep 2018 11:47:50 +0000 (18:47 +0700) |
core/src/ru/deadsoftware/cavecraft/game/GameRenderer.java | patch | blob | history | |
core/src/ru/deadsoftware/cavecraft/game/mobs/Pig.java | patch | blob | history |
diff --git a/core/src/ru/deadsoftware/cavecraft/game/GameRenderer.java b/core/src/ru/deadsoftware/cavecraft/game/GameRenderer.java
index fac4ba2a9f25d42c987e1c6d68e1adaa33d38562..93618f20b0b4aa0e9fae23ae8ef2f565440d46ba 100644 (file)
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();
}
diff --git a/core/src/ru/deadsoftware/cavecraft/game/mobs/Pig.java b/core/src/ru/deadsoftware/cavecraft/game/mobs/Pig.java
index 44333ab18a774d572a0225d3dd3cf56de0e5380a..04a96f6b7d41ad9ced14bc919e584de9ee69f815 100644 (file)
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;