Class TreasureRoom

java.lang.Object
rooms.Room
rooms.TreasureRoom

public class TreasureRoom extends Room
Represents a treasure room where the player can find random items.

When instantiated, the room spawns items at fixed positions based on random chance:

  • 60% chance: a HealthPot and a StrengthPot
  • 30% chance: a TreasureBox
  • 20% chance: two MaxHealthUpgrades and a StrengthPot
  • 10% chance: three MysteryBoxes with cost 0
  • Constructor Details

    • TreasureRoom

      public TreasureRoom(double x, double y, double w, double h, Player player)
      Constructs a TreasureRoom with specified position, size, and player reference. Spawns items randomly according to predefined probabilities.
      Parameters:
      x - the x-coordinate of the top-left corner of the room
      y - the y-coordinate of the top-left corner of the room
      w - the width of the room
      h - the height of the room
      player - the player in this room