Interface Collectible
- All Known Implementing Classes:
Coin,HealthPot,Item,MaxHealthUpgrade,MysteryBox,StrengthPot,TreasureBox
public interface Collectible
Interface representing objects that can be collected by a player.
Examples include coins, power-ups, mystery blocks.
-
Method Summary
Modifier and TypeMethodDescriptionvoidHandles the action when the player collects this item.javafx.geometry.Rectangle2DReturns the hitbox of the collectible for collision detection.voidrender(javafx.scene.canvas.GraphicsContext gc) Renders the collectible on the screen.voidUpdates the state of the collectible.
-
Method Details
-
collect
Handles the action when the player collects this item. This could modify player stats, inventory, or trigger effects.- Parameters:
player- The player who collected the item.
-
update
Updates the state of the collectible. Can be used for animations, timers, or interactions.- Parameters:
dt- Delta time since last update, in seconds.player- The player in the game (for proximity checks, etc.).
-
render
void render(javafx.scene.canvas.GraphicsContext gc) Renders the collectible on the screen.- Parameters:
gc- GraphicsContext to draw the collectible.
-
getHitbox
javafx.geometry.Rectangle2D getHitbox()Returns the hitbox of the collectible for collision detection.- Returns:
- Rectangle2D representing the hitbox.
-