Class CombatRoom

java.lang.Object
rooms.Room
rooms.CombatRoom
Direct Known Subclasses:
BossRoom

public class CombatRoom extends Room
A room where the player must defeat all enemies to unlock the door.

The top door remains locked until all enemies in the room are defeated.

  • Constructor Details

    • CombatRoom

      public CombatRoom(double x, double y, double w, double h, Player player)
      Constructs a CombatRoom with specified position, size, and player reference.
      Parameters:
      x - top-left x-coordinate of the room
      y - top-left y-coordinate of the room
      w - width of the room
      h - height of the room
      player - the player in the room
  • Method Details

    • spawnEnemy

      public void spawnEnemy(Enemy e)
      Adds an enemy to the room.
      Parameters:
      e - the enemy to spawn
    • update

      public void update(double dt)
      Updates the room and its entities.

      The top door is locked if any enemies remain, and unlocked if all enemies are defeated.

      Overrides:
      update in class Room
      Parameters:
      dt - delta time in seconds
    • render

      public void render(javafx.scene.canvas.GraphicsContext gc)
      Renders the room and its entities.

      Adds a red fog overlay if the door is locked, otherwise black fog.

      Overrides:
      render in class Room
      Parameters:
      gc - the GraphicsContext to draw on