Class HealthPot
java.lang.Object
entities.items.Item
entities.items.HealthPot
- All Implemented Interfaces:
Collectible
A collectible health potion item.
When collected by the player, restores a fixed amount of HP.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intAmount of HP restored when collected.private static final javafx.scene.image.ImageSprite image for the health potion.private static final doubleHeight of the health potion sprite.private static final doubleWidth of the health potion sprite. -
Constructor Summary
ConstructorsConstructorDescriptionHealthPot(double x, double y) Constructs a new HealthPot at the specified position. -
Method Summary
-
Field Details
-
WIDTH
private static final double WIDTHWidth of the health potion sprite.- See Also:
-
HEIGHT
private static final double HEIGHTHeight of the health potion sprite.- See Also:
-
HEALING
private static final int HEALINGAmount of HP restored when collected.- See Also:
-
HEALTHPOT_SPRITE
private static final javafx.scene.image.Image HEALTHPOT_SPRITESprite 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 centery- Y coordinate of the health potion center
-
-
Method Details
-
collect
Collects the health potion and restores HP to the player.- Specified by:
collectin interfaceCollectible- Specified by:
collectin classItem- 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:
renderin interfaceCollectible- Specified by:
renderin classItem- Parameters:
gc- GraphicsContext used for rendering
-