Class HealthPot

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

public class HealthPot extends Item
A collectible health potion item. When collected by the player, restores a fixed amount of HP.
  • Field Details

    • WIDTH

      private static final double WIDTH
      Width of the health potion sprite.
      See Also:
    • HEIGHT

      private static final double HEIGHT
      Height of the health potion sprite.
      See Also:
    • HEALING

      private static final int HEALING
      Amount of HP restored when collected.
      See Also:
    • HEALTHPOT_SPRITE

      private static final javafx.scene.image.Image HEALTHPOT_SPRITE
      Sprite image for the health potion.
  • Constructor Details

    • HealthPot

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

    • collect

      public void collect(Player player)
      Collects the health potion and restores HP to the player.
      Specified by:
      collect in interface Collectible
      Specified by:
      collect in class Item
      Parameters:
      player - The player who collects the health potion
    • render

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