diff --git a/core/src/ru/deadsoftware/cavedroid/game/mobs/Mob.java b/core/src/ru/deadsoftware/cavedroid/game/mobs/Mob.java
index 32c63cc26514d674c777f6f5a777104c68508fe4..716c3df07f44dc8e45b06c048716fc721fedeb52 100644 (file)
package ru.deadsoftware.cavedroid.game.mobs;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
package ru.deadsoftware.cavedroid.game.mobs;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
+import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;
private final float height;
private int dir;
private final float height;
private int dir;
- public boolean flyMode;
- public final Vector2 pos;
- public Vector2 mov;
+ protected final Vector2 pos;
+ protected Vector2 mov;
private boolean dead;
private boolean dead;
+ private boolean canJump, flyMode;
protected int animDelta = 6;
protected int animDelta = 6;
- public boolean canJump;
- int anim;
+ protected int anim;
+
+ protected static int randomDir() {
+ return MathUtils.random(1);
+ }
/**
*
/**
*
this.width = width;
this.height = height;
canJump = false;
this.width = width;
this.height = height;
canJump = false;
- flyMode = false;
dead = false;
this.dir = dir;
}
dead = false;
this.dir = dir;
}
return dead;
}
return dead;
}
+ public int getAnim() {
+ return anim;
+ }
+
/**
* Set's mob's dead variable to true and nothing else. It doesn't delete the mob.
*/
/**
* Set's mob's dead variable to true and nothing else. It doesn't delete the mob.
*/
return new Rectangle(pos.x, pos.y, getWidth(), getHeight());
}
return new Rectangle(pos.x, pos.y, getWidth(), getHeight());
}
- public abstract void ai();
+ public Vector2 getPos() {
+ return pos;
+ }
- public abstract void changeDir();
+ public Vector2 getMov() {
+ return mov;
+ }
+
+ public float getX() {
+ return pos.x;
+ }
+
+ public float getY() {
+ return pos.y;
+ }
+
+ public boolean canJump() {
+ return canJump;
+ }
+
+ public void setCanJump(boolean canJump) {
+ this.canJump = canJump;
+ }
+
+ public boolean isFlyMode() {
+ return flyMode;
+ }
+
+ public void setFlyMode(boolean flyMode) {
+ this.flyMode = flyMode;
+ }
public abstract void draw(SpriteBatch spriteBatch, float x, float y);
public abstract void draw(SpriteBatch spriteBatch, float x, float y);
+ public abstract void ai();
+
+ public abstract void changeDir();
+
/**
*
* @return 0 - if regular mob. <br>
/**
*
* @return 0 - if regular mob. <br>