Compare commits
2 Commits
4f9d1dfcb6
...
c4b1d029aa
| Author | SHA1 | Date | |
|---|---|---|---|
|
c4b1d029aa
|
|||
|
c8d7a56934
|
@@ -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();
|
||||
|
||||
@@ -182,7 +183,6 @@ public class Entity {
|
||||
hpBarCount = 0;
|
||||
changeOpacity(graphics2d, 0.4f);
|
||||
}
|
||||
//TODO: fix attacking sprite drawing position for monsters
|
||||
if(dying) dyingAnimation(graphics2d);
|
||||
if(type == EntityType.PLAYER || name.equals("orc")) { // only modify sprite render position for player because I dont know yet how monster attack sprite are gonna look
|
||||
if(attacking) graphics2d.drawImage(parseSpriteATK(),
|
||||
@@ -223,7 +223,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 +400,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 +532,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) {
|
||||
|
||||
@@ -39,12 +39,8 @@ public class OrcMON extends Entity {
|
||||
|
||||
// INTERACTION
|
||||
public void setAction() {
|
||||
if(!onPath) checkStartChasing(panel.player, 10 ,100);
|
||||
if(!onPath) checkStartChasing(panel.player, 10 ,100); else followPlayer();
|
||||
checkStopChasing(panel.player, 15, 100);
|
||||
if(onPath) {
|
||||
followPlayer();
|
||||
return;
|
||||
}
|
||||
setRandomDirection();
|
||||
if(!attacking) checkAttack(30, panel.tileSize*4, panel.tileSize);
|
||||
}
|
||||
@@ -71,13 +67,13 @@ public class OrcMON extends Entity {
|
||||
right2 = initEntitySprites("monster/orc_right_2");
|
||||
}
|
||||
public void getAttackImage() {
|
||||
attackUp1 = initEntitySprites("monster/orc_attack_up_1");
|
||||
attackUp2 = initEntitySprites("monster/orc_attack_up_2");
|
||||
attackDown1 = initEntitySprites("monster/orc_attack_down_1");
|
||||
attackDown2 = initEntitySprites("monster/orc_attack_down_2");
|
||||
attackLeft1 = initEntitySprites("monster/orc_attack_left_1");
|
||||
attackLeft2 = initEntitySprites("monster/orc_attack_left_2");
|
||||
attackRight1 = initEntitySprites("monster/orc_attack_right_1");
|
||||
attackRight2 = initEntitySprites("monster/orc_attack_right_2");
|
||||
attackUp1 = initEntitySprites("monster/orc_attack_up_1", panel.tileSize, panel.tileSize * 2);
|
||||
attackUp2 = initEntitySprites("monster/orc_attack_up_2", panel.tileSize, panel.tileSize * 2);
|
||||
attackDown1 = initEntitySprites("monster/orc_attack_down_1", panel.tileSize, panel.tileSize * 2);
|
||||
attackDown2 = initEntitySprites("monster/orc_attack_down_2", panel.tileSize, panel.tileSize * 2);
|
||||
attackLeft1 = initEntitySprites("monster/orc_attack_left_1", panel.tileSize*2, panel.tileSize);
|
||||
attackLeft2 = initEntitySprites("monster/orc_attack_left_2", panel.tileSize*2, panel.tileSize);
|
||||
attackRight1 = initEntitySprites("monster/orc_attack_right_1", panel.tileSize*2, panel.tileSize);
|
||||
attackRight2 = initEntitySprites("monster/orc_attack_right_2", panel.tileSize*2, panel.tileSize);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user