Class PlayerBubbleModel

java.lang.Object
model.entities.EntityModel
model.bubbles.BubbleModel
model.bubbles.playerBubbles.PlayerBubbleModel
Direct Known Subclasses:
EmptyBubbleModel

public abstract class PlayerBubbleModel extends BubbleModel
Abstract model for player bubbles.

This class provides the basic structure and behavior for bubbles created by the player. It includes methods for updating the bubble's state, handling collisions with the player, and managing timers.

  • Field Details

  • Constructor Details

    • PlayerBubbleModel

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

    • updateDeadAction

      protected abstract void updateDeadAction()
      Updates the bubble's movement after it has been popped by the player.
    • pop

      public abstract void pop()
      Pops the bubble and updates its state.
    • playerPop

      public abstract void playerPop(PlayerModel playerModel, int EnemyBubblePopCounter, ChainReactionManager chainReactionManager)
      Handles the player popping the bubble, this overloaded method is used only by the ChainReactionManager.
      Parameters:
      playerModel - the player model
      EnemyBubblePopCounter - the number of enemy bubbles popped
      chainReactionManager - the chain explosion manager
    • update

      public void update()
      Updates the bubble's state and position.
      Specified by:
      update in class BubbleModel
    • checkCollisionWithPlayer

      public void checkCollisionWithPlayer(PlayerModel playerModel)
      Checks for collisions with the player and handles the interaction.
      Specified by:
      checkCollisionWithPlayer in class BubbleModel
      Parameters:
      playerModel - the player model
    • updateTimers

      protected void updateTimers()
      Updates the timers for the bubble's state transitions.
      Overrides:
      updateTimers in class BubbleModel