Class PowerUpModel

java.lang.Object
model.itemesAndRewards.ItemModel
model.itemesAndRewards.PowerUpModel

public class PowerUpModel extends ItemModel
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.

  • Constructor Details

    • PowerUpModel

      public PowerUpModel(int x, int y, Constants.Items.PowerUpType powerUpType)
      Constructs a new PowerUpModel with the specified position and power-up type.
      Parameters:
      x - the x-coordinate of the power-up item
      y - the y-coordinate of the power-up item
      powerUpType - 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.
      Specified by:
      addPoints in class ItemModel
    • applyEffect

      public void applyEffect()
      Applies the effect of the power-up to the player.
      Specified by:
      applyEffect in class ItemModel
    • getPowerUpType

      public Constants.Items.PowerUpType getPowerUpType()
      Returns the type of the power-up item.
      Returns:
      the type of the power-up item