Class MaxHealthUpgrade

java.lang.Object
entities.items.Item
entities.items.MaxHealthUpgrade
All Implemented Interfaces:
Collectible

public class MaxHealthUpgrade extends Item
A collectible item that increases the player's maximum health. When collected, it increases the player's max HP and restores HP to full.
  • Field Details

    • WIDTH

      private static final double WIDTH
      Width of the upgrade item sprite.
      See Also:
    • HEIGHT

      private static final double HEIGHT
      Height of the upgrade item sprite.
      See Also:
    • MAXHEALTHUP

      private static final int MAXHEALTHUP
      Amount to increase the player's maximum health by.
      See Also:
    • MAXHP_SPRITE

      private static final javafx.scene.image.Image MAXHP_SPRITE
      Sprite image for the health upgrade.
  • Constructor Details

    • MaxHealthUpgrade

      public MaxHealthUpgrade(double x, double y)
      Constructs a new MaxHealthUpgrade at the specified position.
      Parameters:
      x - X coordinate of the item center
      y - Y coordinate of the item center
  • Method Details

    • collect

      public void collect(Player player)
      Collects the item, increasing the player's max HP and restoring current HP to full.
      Specified by:
      collect in interface Collectible
      Specified by:
      collect in class Item
      Parameters:
      player - The player who collects the item
    • render

      public void render(javafx.scene.canvas.GraphicsContext gc)
      Renders the max health upgrade at its current position.
      Specified by:
      render in interface Collectible
      Specified by:
      render in class Item
      Parameters:
      gc - GraphicsContext used for rendering