Package view.bubbles

Class BubbleView

java.lang.Object
view.bubbles.BubbleView
Direct Known Subclasses:
LightningBubbleView, PlayerBubbleView, WaterBubbleView

public abstract class BubbleView extends Object
The BubbleView is a abstract class that represents the view for a BubbleModel. It handles updating the bubble's animation and drawing the bubble on the screen.
  • Field Details

    • bubbleModel

      protected BubbleModel bubbleModel
    • animationIndex

      protected int animationIndex
    • animationTick

      protected int animationTick
    • animationReset

      protected boolean animationReset
    • soundPlayed

      protected boolean soundPlayed
  • Constructor Details

    • BubbleView

      public BubbleView(BubbleModel bubbleModel)
      Constructs a BubbleView with the specified BubbleModel.
      Parameters:
      bubbleModel - the model for the bubble entity
  • Method Details

    • update

      public abstract void update()
      Updates the bubble's state and animation.
    • draw

      public abstract void draw(Graphics g)
      Draws the bubble on the screen.
      Parameters:
      g - the Graphics object to draw with
    • updateAnimationTick

      protected void updateAnimationTick()
      Updates the animation tick and index based on the animation speed.
    • isActive

      public boolean isActive()
      Checks if the bubble is active.
      Returns:
      true if the bubble is active, false otherwise
    • getBubbleModel

      public BubbleModel getBubbleModel()
      Returns the BubbleModel associated with this view.
      Returns:
      the BubbleModel associated with this view