mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-07-23 06:08:09 +07:00
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:
@ -3,6 +3,7 @@ package gdx.diablo.ai;
|
|||||||
import gdx.diablo.entity.Monster;
|
import gdx.diablo.entity.Monster;
|
||||||
|
|
||||||
public abstract class AI {
|
public abstract class AI {
|
||||||
|
public static final AI IDLE = new Idle();
|
||||||
|
|
||||||
protected Monster entity;
|
protected Monster entity;
|
||||||
|
|
||||||
|
10
core/src/gdx/diablo/ai/Idle.java
Normal file
10
core/src/gdx/diablo/ai/Idle.java
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
package gdx.diablo.ai;
|
||||||
|
|
||||||
|
public class Idle extends AI {
|
||||||
|
public Idle() {
|
||||||
|
super(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(float delta) {}
|
||||||
|
}
|
@ -127,7 +127,7 @@ public class Entity {
|
|||||||
String weaponClass;
|
String weaponClass;
|
||||||
Vector3 position = new Vector3();
|
Vector3 position = new Vector3();
|
||||||
Vector3 velocity = 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;
|
boolean running = false;
|
||||||
float walkSpeed = 6;
|
float walkSpeed = 6;
|
||||||
@ -529,4 +529,6 @@ public class Entity {
|
|||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void select(Player player) {}
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,9 @@ public class Monster extends Entity {
|
|||||||
//if (!object.Draw) return null; // TODO: Not yet
|
//if (!object.Draw) return null; // TODO: Not yet
|
||||||
|
|
||||||
Monster monster = new Monster(map, obj, monstats);
|
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);
|
monster.ai = new Npc(monster);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user