public AStar(int x, int y, int rank, Classification classification) { this.x = x << 4; this.y = y << 4; this.rank = rank; this.classification = classification; sprite = animSprite.getSprite(); hitbox = new MobHitbox(Sprite.hitbox21x32); inventory = new Inventory(); healthBar0 = new MobHealthBar((int) this.x - 10, (int) this.y - 20, Sprite.healthBar0); healthBar25 = new MobHealthBar((int) this.x - 5, (int) this.y - 20, Sprite.healthBar25); healthBar50 = new MobHealthBar((int) this.x, (int) this.y - 20, Sprite.healthBar50); healthBar75 = new MobHealthBar((int) this.x + 5, (int) this.y - 20, Sprite.healthBar75); // Shooter default attributes maxHealth = Experience.calculateMobHealth(this, 100); health = maxHealth; maxMana = Experience.calculateMobMana(this, 100); mana = maxMana; armor = Experience.calculateMobArmor(this, 0); protectSpell = 0.0; }
public void tick() { time++; move(); if (walking) animSprite.tick(); else animSprite.setFrame(0); if (ya < 0) { animSprite = up; dir = Mob.Direction.UP; } else if (ya > 0) { animSprite = down; dir = Mob.Direction.DOWN; } if (xa < 0) { animSprite = left; dir = Mob.Direction.LEFT; } else if (xa > 0) { animSprite = right; dir = Mob.Direction.RIGHT; } // getStatusEffects(); healthBar0.setXY(this.x - 10, this.y - 20); healthBar25.setXY(this.x - 5, this.y - 20); healthBar50.setXY(this.x, this.y - 20); healthBar75.setXY(this.x + 5, this.y - 20); if (health / maxHealth > 0 && !health0) { level.add(healthBar0); if (health / maxHealth > .25 && !health25) { level.add(healthBar25); if (health / maxHealth > .5 && !health50) { level.add(healthBar50); if (health / maxHealth > .75 && !health75) { level.add(healthBar75); health75 = true; } health50 = true; } health25 = true; } health0 = true; } if (health / maxHealth <= .75) { if (health75) { healthBar75.remove(); health75 = false; } if (health / maxHealth <= .5) { if (health50) { healthBar50.remove(); health50 = false; } if (health / maxHealth <= .25) { if (health25) { healthBar25.remove(); health25 = false; } } } } }
public void render(Screen screen) { sprite = animSprite.getSprite(); screen.renderMob((int) (x - 16), (int) (y - 16), sprite); hitbox.render((int) x - 10, (int) y - 16, screen); }