Package model.bubbles.playerBubbles
Class PlayerBubbleModel
java.lang.Object
model.entities.EntityModel
model.bubbles.BubbleModel
model.bubbles.playerBubbles.PlayerBubbleModel
- Direct Known Subclasses:
EmptyBubbleModel
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 Summary
FieldsFields 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
ConstructorsConstructorDescriptionPlayerBubbleModel(float x, float y, Constants.Direction direction) Constructs a new PlayerBubbleModel. -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckCollisionWithPlayer(PlayerModel playerModel) Checks for collisions with the player and handles the interaction.abstract voidplayerPop(PlayerModel playerModel, int EnemyBubblePopCounter, ChainReactionManager chainReactionManager) Handles the player popping the bubble, this overloaded method is used only by theChainReactionManager.abstract voidpop()Pops the bubble and updates its state.voidupdate()Updates the bubble's state and position.protected abstract voidUpdates the bubble's movement after it has been popped by the player.protected voidUpdates the timers for the bubble's state transitions.Methods inherited from class model.bubbles.BubbleModel
bounceDown, bubbleShaking, changeDirection, getBubbleType, getCenter, getDirection, getState, handlePlayerPush, initCollisionBoxes, isActive, isPlayerJumpingOnBubble, isPlayerPoppingBubble, isPlayerTouchingBubble, isPopped, pacManEffect, setActive, updateCollisionBoxes, updateDirection, updatePositionMethods inherited from class model.entities.EntityModel
conpenetrationSafeUpdateXPos, deactivate, getHitbox, getTileX, getTileY, initHitbox, initLevelManager, isImmune, updateXPos
-
Field Details
-
bubbleManager
-
-
Constructor Details
-
PlayerBubbleModel
Constructs a new PlayerBubbleModel.- Parameters:
x- the starting x coordinatey- the starting y coordinatedirection- 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 theChainReactionManager.- Parameters:
playerModel- the player modelEnemyBubblePopCounter- the number of enemy bubbles poppedchainReactionManager- the chain explosion manager
-
update
public void update()Updates the bubble's state and position.- Specified by:
updatein classBubbleModel
-
checkCollisionWithPlayer
Checks for collisions with the player and handles the interaction.- Specified by:
checkCollisionWithPlayerin classBubbleModel- Parameters:
playerModel- the player model
-
updateTimers
protected void updateTimers()Updates the timers for the bubble's state transitions.- Overrides:
updateTimersin classBubbleModel
-