refactor Orc monster actions and improve attack image initialization (closes #8)
This commit is contained in:
@@ -121,7 +121,8 @@ public class Entity {
|
||||
knockback = false;
|
||||
knockbackCount = 0;
|
||||
speed = defaultSpeed;
|
||||
} else if(attacking) attacking(); else {
|
||||
} else if(attacking) attacking();
|
||||
else {
|
||||
setAction();
|
||||
checkCollision();
|
||||
|
||||
@@ -223,7 +224,7 @@ public class Entity {
|
||||
solidArea.width = attackArea.width;
|
||||
solidArea.height = attackArea.height;
|
||||
|
||||
if(type == EntityType.MONSTER) if(panel.collisionH.checkPlayer(this)) damagePlayer(attackValue);
|
||||
if(type == EntityType.MONSTER) if(panel.collisionH.checkPlayer(this)) damagePlayer(attack);
|
||||
|
||||
if(type == EntityType.PLAYER) {
|
||||
int monsterIndex = panel.collisionH.checkEntity(this, panel.monster[panel.currentMap.getIndex()]);
|
||||
@@ -400,7 +401,7 @@ public class Entity {
|
||||
return Math.abs(worldY - target.worldY);
|
||||
}
|
||||
public int dTile(Entity target) {
|
||||
if(Objects.equals(name, "orc")) System.out.println("dX: " + dX(target) + " dY: " + dY(target));
|
||||
//if(Objects.equals(name, "orc")) System.out.println("dX: " + dX(target) + " dY: " + dY(target));
|
||||
return (dX(target) + dY(target)) / panel.tileSize;
|
||||
}
|
||||
public int getGoalCol(Entity target) {
|
||||
@@ -532,7 +533,7 @@ public class Entity {
|
||||
}
|
||||
}
|
||||
public void checkStopChasing(Entity target, int distance, int rate) {
|
||||
if(Objects.equals(name, "orc")) System.out.println("dTile: " + dTile(target) + " distance: " + distance);
|
||||
//if(Objects.equals(name, "orc")) System.out.println("dTile: " + dTile(target) + " distance: " + distance);
|
||||
if(dTile(target) > distance) onPath = false;
|
||||
}
|
||||
public void checkStartChasing(Entity target, int distance, int rate) {
|
||||
|
||||
Reference in New Issue
Block a user