public void draw(Graphics window, int x, int y) {
    window.setColor(Color.CYAN);
    window.fillOval(x + 8, y + 11, 45 - 16, 45 - 16);
    window.setColor(Color.BLACK);
    window.fillOval(x + 14, y + 15, 5, 5); // eyes
    window.fillOval(x + 25, y + 15, 5, 5); // eyes
    imgFound = false;

    // health bar
    window.setColor(Color.RED);
    window.fillRect(x, y, 45, 9);
    window.setColor(Color.GREEN);
    window.fillRect(x, y, (int) ((double) currentHealth / (double) (maxHealth) * 45), 9);
  }
  public void draw(Graphics window, int scale, int x, int y) {
    window.setColor(Color.CYAN);
    window.fillOval(
        x + 8 * scale / 45, y + 11 * scale / 45, scale - 16 * scale / 45, scale - 16 * scale / 45);
    window.setColor(Color.BLACK);
    window.fillOval(
        x + 14 * scale / 45, y + 15 * scale / 45, 5 * scale / 45, 5 * scale / 45); // eyes
    window.fillOval(
        x + 25 * scale / 45, y + 15 * scale / 45, 5 * scale / 45, 5 * scale / 45); // eyes
    imgFound = false;

    // health bar
    window.setColor(Color.RED);
    window.fillRect(x, y, scale - 1, 9 * scale / 45);
    window.setColor(Color.GREEN);
    window.fillRect(
        x, y, (int) ((double) currentHealth / (double) (maxHealth) * (scale - 1)), 9 * scale / 45);
  }
Example #3
0
 public void drawChar(Graphics g) {
   g.drawImage(character, x, y, xSize, ySize, null);
   // System.out.println(yLoc);
 }