Package model.itemesAndRewards
Class PowerUpModel
java.lang.Object
model.itemesAndRewards.ItemModel
model.itemesAndRewards.PowerUpModel
Contains the logic a power-up item in the game.
The PowerUpModel class extends the ItemModel class and handles the behavior of power-up items,
including their effects on the player and the points they add when collected.
-
Field Summary
Fields inherited from class model.itemesAndRewards.ItemModel
active, collected, deSpawning, deSpawnTimer, hitbox, itemType, timer, x, y -
Constructor Summary
ConstructorsConstructorDescriptionPowerUpModel(int x, int y, Constants.Items.PowerUpType powerUpType) Constructs a new PowerUpModel with the specified position and power-up type. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds points to the player's score based on the power-up type.voidApplies the effect of the power-up to the player.Returns the type of the power-up item.Methods inherited from class model.itemesAndRewards.ItemModel
deactivateItem, getHitbox, getItemType, initHitbox, isActive, isCollected, isDeSpawning, setCollected, update
-
Constructor Details
-
PowerUpModel
Constructs a new PowerUpModel with the specified position and power-up type.- Parameters:
x- the x-coordinate of the power-up itemy- the y-coordinate of the power-up itempowerUpType- the type of the power-up item
-
-
Method Details
-
addPoints
public void addPoints()Adds points to the player's score based on the power-up type. -
applyEffect
public void applyEffect()Applies the effect of the power-up to the player.- Specified by:
applyEffectin classItemModel
-
getPowerUpType
Returns the type of the power-up item.- Returns:
- the type of the power-up item
-