public NPC() { location = new Location(10 * StaticVar.terrainImageWidth, 10 * StaticVar.terrainImageHeight); direction = 270; canPassMountain = false; // if anything this should be under skills (Sam) canPassWater = false; inventory = new Inventory(); equipment = new Equipment(); stats = new NPCStats(); stats.setLife(100); stats.setCurrentLife(100); stats.setAttackTime(StaticVar.fps); }
// Should be named updatePosition -Sam @Override public void update(int xMovement, int yMovement, long elapsed) { if (xMovement == 0 && yMovement == 0) { currentlyMoving = false; } else { location.incrementX( Math.round(xMovement * elapsed * StaticVar.entitySpeed * stats.getMovement())); location.incrementY( Math.round(yMovement * elapsed * StaticVar.entitySpeed * stats.getMovement())); if (yMovement > 0) yMovement = 1; else if (yMovement < 0) yMovement = -1; xMovement /= 26; changeDirection(xMovement, yMovement); currentlyMoving = true; } }
public void resetTimeUntilAttack() { timeUntilAttack = stats.getAttackTime(); }
public boolean isAlive() { if (stats.getCurrentLife() <= 0) return false; else return true; }