Class TreasureRoom
java.lang.Object
rooms.Room
rooms.TreasureRoom
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
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionTreasureRoom(double x, double y, double w, double h, Player player) Constructs a TreasureRoom with specified position, size, and player reference. -
Method Summary
Methods inherited from class rooms.Room
addDoor, addEnemy, drawFog, getBullets, getCharacters, getDoorAtPlayer, getEnemies, getFloorSprite, getHeight, getItems, getLasers, getWidth, isActive, render, renderEntities, setActive, spawnBullet, spawnItems, spawnLaser, update, updateEntities
-
Constructor Details
-
TreasureRoom
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 roomy- the y-coordinate of the top-left corner of the roomw- the width of the roomh- the height of the roomplayer- the player in this room
-