Added Idle AI (default AI)

Added Idle AI (default AI) -- does nothing
Changed default angle for entities to align with correct default direction
This commit is contained in:
Collin Smith 2019-02-22 22:11:47 -08:00
parent f1fb2e69b2
commit edc4166a8d
4 changed files with 17 additions and 2 deletions

View File

@ -3,6 +3,7 @@ package gdx.diablo.ai;
import gdx.diablo.entity.Monster;
public abstract class AI {
public static final AI IDLE = new Idle();
protected Monster entity;

View File

@ -0,0 +1,10 @@
package gdx.diablo.ai;
public class Idle extends AI {
public Idle() {
super(null);
}
@Override
public void update(float delta) {}
}

View File

@ -127,7 +127,7 @@ public class Entity {
String weaponClass;
Vector3 position = new Vector3();
Vector3 velocity = new Vector3();
float angle = MathUtils.PI * 3 / 2;
float angle = MathUtils.atan2(-1, -2);//MathUtils.PI * 3 / 2;
boolean running = false;
float walkSpeed = 6;
@ -529,4 +529,6 @@ public class Entity {
public String getName() {
return name;
}
public void select(Player player) {}
}

View File

@ -60,7 +60,9 @@ public class Monster extends Entity {
//if (!object.Draw) return null; // TODO: Not yet
Monster monster = new Monster(map, obj, monstats);
if (monstats.AI.equalsIgnoreCase("Npc")) {
if (monstats.AI.equalsIgnoreCase("Idle")) {
monster.ai = AI.IDLE;
} else if (monstats.AI.equalsIgnoreCase("Npc")) {
monster.ai = new Npc(monster);
}