Class WaterBubbleModel


public class WaterBubbleModel extends SpecialBubbleModel
Represents a water bubble generated by the BubbleGenerator.

This class extends the SpecialBubbleModel and provides specific behavior for water bubbles. When popped by the player, it spawns a WaterFlowModel and increases the water bubble pop counter in the PowerUpManagerModel.

  • Constructor Details

    • WaterBubbleModel

      public WaterBubbleModel(float x, float y, Constants.Direction direction)
      Constructs a new WaterBubbleModel.
      Parameters:
      x - the starting x coordinate
      y - the starting y coordinate
      direction - the starting direction
  • Method Details

    • update

      public void update()
      Updates the state and position of the water bubble.

      This method updates the timers, direction, position, collision boxes, and applies the Pac-Man effect.

      Specified by:
      update in class SpecialBubbleModel
    • playerPop

      public void playerPop(PlayerModel playerModel)
      Handles the player popping the water bubble.

      This method deactivates the bubble, spawns a water flow at the bubble's position, and increases the water bubble pop counter.

      Specified by:
      playerPop in class SpecialBubbleModel
      Parameters:
      playerModel - the player model