Package model.bubbles.specialBubbles
Class LightningBubbleModel
java.lang.Object
model.entities.EntityModel
model.bubbles.BubbleModel
model.bubbles.specialBubbles.SpecialBubbleModel
model.bubbles.specialBubbles.LightningBubbleModel
Represents a lightning bubble generated by the
BubbleGenerator.
This class extends the SpecialBubbleModel and provides specific behavior for lightning bubbles.
When popped by the player, it spawns a LightingProjectileModel
-
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
ConstructorsConstructorDescriptionLightningBubbleModel(float x, float y, Constants.Direction direction) Constructs a new LightningBubbleModel. -
Method Summary
Modifier and TypeMethodDescriptionvoidplayerPop(PlayerModel playerModel) Handles the player popping the lightning bubble.voidupdate()Updates the state and position of the lightning 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
-
LightningBubbleModel
Constructs a new LightningBubbleModel.- 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 lightning 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 lightning bubble.This method deactivates the bubble and spawns a lightning projectile at the bubble's position.
- Specified by:
playerPopin classSpecialBubbleModel- Parameters:
playerModel- the player model
-