Package model.bubbles.specialBubbles
Class WaterBubbleModel
java.lang.Object
model.entities.EntityModel
model.bubbles.BubbleModel
model.bubbles.specialBubbles.SpecialBubbleModel
model.bubbles.specialBubbles.WaterBubbleModel
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.
-
Field Summary
Fields inherited from class model.bubbles.BubbleModel
active, blinkingTimer, bubbleType, direction, externalCollisionBox, internalCollisionBox, levelManagerModel, normalTimer, popped, popTimer, previousDirection, previousState, redTimer, shake, shakeTimer, state, timer, xSpeed, ySpeed -
Constructor Summary
ConstructorsConstructorDescriptionWaterBubbleModel(float x, float y, Constants.Direction direction) Constructs a new WaterBubbleModel. -
Method Summary
Modifier and TypeMethodDescriptionvoidplayerPop(PlayerModel playerModel) Handles the player popping the water bubble.voidupdate()Updates the state and position of the water bubble.Methods inherited from class model.bubbles.specialBubbles.SpecialBubbleModel
checkCollisionWithPlayerMethods inherited from class model.bubbles.BubbleModel
bounceDown, bubbleShaking, changeDirection, getBubbleType, getCenter, getDirection, getState, handlePlayerPush, initCollisionBoxes, isActive, isPlayerJumpingOnBubble, isPlayerPoppingBubble, isPlayerTouchingBubble, isPopped, pacManEffect, setActive, updateCollisionBoxes, updateDirection, updatePosition, updateTimersMethods inherited from class model.entities.EntityModel
conpenetrationSafeUpdateXPos, deactivate, getHitbox, getTileX, getTileY, initHitbox, initLevelManager, isImmune, updateXPos
-
Constructor Details
-
WaterBubbleModel
Constructs a new WaterBubbleModel.- Parameters:
x- the starting x coordinatey- the starting y coordinatedirection- 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:
updatein classSpecialBubbleModel
-
playerPop
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:
playerPopin classSpecialBubbleModel- Parameters:
playerModel- the player model
-