Class MaxHealthUpgrade
java.lang.Object
entities.items.Item
entities.items.MaxHealthUpgrade
- All Implemented Interfaces:
Collectible
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 Summary
FieldsModifier and TypeFieldDescriptionprivate static final doubleHeight of the upgrade item sprite.private static final intAmount to increase the player's maximum health by.private static final javafx.scene.image.ImageSprite image for the health upgrade.private static final doubleWidth of the upgrade item sprite. -
Constructor Summary
ConstructorsConstructorDescriptionMaxHealthUpgrade(double x, double y) Constructs a new MaxHealthUpgrade at the specified position. -
Method Summary
-
Field Details
-
WIDTH
private static final double WIDTHWidth of the upgrade item sprite.- See Also:
-
HEIGHT
private static final double HEIGHTHeight of the upgrade item sprite.- See Also:
-
MAXHEALTHUP
private static final int MAXHEALTHUPAmount to increase the player's maximum health by.- See Also:
-
MAXHP_SPRITE
private static final javafx.scene.image.Image MAXHP_SPRITESprite 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 centery- Y coordinate of the item center
-
-
Method Details
-
collect
Collects the item, increasing the player's max HP and restoring current HP to full.- Specified by:
collectin interfaceCollectible- Specified by:
collectin classItem- 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:
renderin interfaceCollectible- Specified by:
renderin classItem- Parameters:
gc- GraphicsContext used for rendering
-