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 Type
    Method
    Description
    void
    collect(Player player)
    Handles the action when the player collects this item.
    javafx.geometry.Rectangle2D
    Returns the hitbox of the collectible for collision detection.
    void
    render(javafx.scene.canvas.GraphicsContext gc)
    Renders the collectible on the screen.
    void
    update(double dt, Player player)
    Updates the state of the collectible.
  • Method Details

    • collect

      void collect(Player player)
      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

      void update(double dt, Player player)
      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.