Package view.bubbles
Class BubbleView
java.lang.Object
view.bubbles.BubbleView
- Direct Known Subclasses:
LightningBubbleView,PlayerBubbleView,WaterBubbleView
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 Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected booleanprotected intprotected BubbleModelprotected boolean -
Constructor Summary
ConstructorsConstructorDescriptionBubbleView(BubbleModel bubbleModel) Constructs a BubbleView with the specified BubbleModel. -
Method Summary
Modifier and TypeMethodDescriptionabstract voidDraws the bubble on the screen.Returns the BubbleModel associated with this view.booleanisActive()Checks if the bubble is active.abstract voidupdate()Updates the bubble's state and animation.protected voidUpdates the animation tick and index based on the animation speed.
-
Field Details
-
bubbleModel
-
animationIndex
protected int animationIndex -
animationTick
protected int animationTick -
animationReset
protected boolean animationReset -
soundPlayed
protected boolean soundPlayed
-
-
Constructor Details
-
BubbleView
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
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
Returns the BubbleModel associated with this view.- Returns:
- the BubbleModel associated with this view
-