Package model.itemesAndRewards
Class PowerUpManagerModel
java.lang.Object
model.itemesAndRewards.PowerUpManagerModel
Manages the power-ups in the game.
The PowerUpManagerModel class is responsible for handling the activation and effects of power-ups collected by the player. It tracks various power-up states and counters, applies power-up effects to the player, and determines which power-up to spawn based on game events.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddDistance(float distance) Adds the specified distance to the walked distance counter.voidApplies the effects of the active power-ups to the player.voidMarks the blue candy as collected and resets the bubble pop counter.voidMarks the blue parasol as collected and resets the water bubble pop counter.voidMarks the Chack'n Heart as collected and resets the item collect counter.voidMarks the crystal ring as collected and resets the blue candy counter.voidMarks the emerald ring as collected and resets the green candy counter.voidMarks the green candy as collected and resets the bubble shoot counter.voidMarks the orange parasol as collected and resets the water bubble pop counter.voidMarks the red candy as collected and resets the jump counter.voidMarks the ruby ring as collected and resets the red candy counter.voidMarks the shoe as collected and resets the walked distance counter.static PowerUpManagerModelDetermines which power-up to spawn based on game events and counters.voidIncreases the bubble pop counter.voidIncreases the bubble shoot counter.voidIncreases the item collect counter.voidIncreases the jump counter.voidIncreases the water bubble pop counter.voidResets the state of the power-up manager for a new play session.voidreset()Resets all power-up states and counters.voidupdate()Updates the state of the power-ups and applies their effects to the player.
-
Method Details
-
getInstance
-
update
public void update()Updates the state of the power-ups and applies their effects to the player. -
applyPowerUp
public void applyPowerUp()Applies the effects of the active power-ups to the player. -
getPowerUpToSpawn
Determines which power-up to spawn based on game events and counters.- Returns:
- the type of power-up to spawn, or null if no power-up should be spawned
-
newPlayReset
public void newPlayReset()Resets the state of the power-up manager for a new play session. -
reset
public void reset()Resets all power-up states and counters. -
increaseBubbleShootCounter
public void increaseBubbleShootCounter()Increases the bubble shoot counter. -
increaseBubblePopCounter
public void increaseBubblePopCounter()Increases the bubble pop counter. -
increaseJumpCounter
public void increaseJumpCounter()Increases the jump counter. -
addDistance
public void addDistance(float distance) Adds the specified distance to the walked distance counter.- Parameters:
distance- the distance to add
-
increaseWaterBubblePopCounter
public void increaseWaterBubblePopCounter()Increases the water bubble pop counter. -
increaseItemCollectCounter
public void increaseItemCollectCounter()Increases the item collect counter. -
collectedGreenCandy
public void collectedGreenCandy()Marks the green candy as collected and resets the bubble shoot counter. -
collectedBlueCandy
public void collectedBlueCandy()Marks the blue candy as collected and resets the bubble pop counter. -
collectedRedCandyCounter
public void collectedRedCandyCounter()Marks the red candy as collected and resets the jump counter. -
collectedShoe
public void collectedShoe()Marks the shoe as collected and resets the walked distance counter. -
collectedOrangeParasol
public void collectedOrangeParasol()Marks the orange parasol as collected and resets the water bubble pop counter. -
collectedBlueParasol
public void collectedBlueParasol()Marks the blue parasol as collected and resets the water bubble pop counter. -
collectedChacknHeart
public void collectedChacknHeart()Marks the Chack'n Heart as collected and resets the item collect counter. -
collectedCrystalRing
public void collectedCrystalRing()Marks the crystal ring as collected and resets the blue candy counter. -
collectedEmeraldRing
public void collectedEmeraldRing()Marks the emerald ring as collected and resets the green candy counter. -
collectedRubyRing
public void collectedRubyRing()Marks the ruby ring as collected and resets the red candy counter.
-