Esempio n. 1
0
 private void renderEnergyBar(Entity entity, int x, int y) {
   int yPos = y + ((int) entity.boundingRadius() + 10);
   graphics.drawRect(x - 15, yPos, 30, 7);
   Color originalColor = graphics.getColor();
   graphics.setColor(Color.BLUE);
   double energyBarLength = 29.0 * entity.energy();
   graphics.fillRect(x - 14, yPos + 1, (int) energyBarLength, 6);
   graphics.setColor(originalColor);
 }
Esempio n. 2
0
 private void renderHealthBar(Entity entity, int x, int y) {
   int yPos = y - ((int) entity.boundingRadius() + 10);
   graphics.drawRect(x - 15, yPos, 30, 7);
   Color originalColor = graphics.getColor();
   double health = entity.health();
   graphics.setColor(getColorFor(health));
   double healthBarLength = 29.0 * health;
   graphics.fillRect(x - 14, yPos + 1, (int) healthBarLength, 6);
   graphics.setColor(originalColor);
 }