Class PowerUpView

java.lang.Object
view.itemsAndRewards.ItemView
view.itemsAndRewards.PowerUpView

public class PowerUpView extends ItemView
The PowerUpView class represents the view for the PowerUpModel class. It handles drawing the power-up item and playing audio effects when the item is collected.
  • Constructor Details

    • PowerUpView

      public PowerUpView(ItemModel itemModel)
      Constructs a PowerUpView with the specified ItemModel.
      Parameters:
      itemModel - the model of the power-up item
  • Method Details

    • draw

      public void draw(Graphics g)
      Draws the power-up item on the screen. If the item is de-spawning, it draws the de-spawning animation.
      Specified by:
      draw in class ItemView
      Parameters:
      g - the Graphics object to draw with
    • audioEffects

      public void audioEffects()
      Plays the audio effects for the power-up item when it is collected. Ensures the sound is played only once.
      Specified by:
      audioEffects in class ItemView