Class PowerUp

java.lang.Object
  extended by Obj
      extended by PowerUp

public class PowerUp
extends Obj

A PowerUp will wait in the map for a Player to pick it up. When picked up, it will alter some trait of the Player, usually beneficial. PowerUp codes: 0: adds Bombs to Player's inventory 1: enables Player's Bombs to spread Fire over a larger radius 2: resets Player's traits to default conditions

Author:
Tyler

Field Summary
private  int power
           
private  java.awt.image.BufferedImage powerUpImage
           
 
Constructor Summary
PowerUp(Grid gr)
          Creates a PowerUp with a random power.
PowerUp(Grid gr, int num)
          Creates a PowerUp with given power.
 
Method Summary
 java.awt.image.BufferedImage getImage()
          Returns the image to be drawn in the grid.
 int getPowerUp()
          Returns the number representing the type of PowerUp this is.
 void getPowerUp(Player p)
          Given the calling Player, alters the Player's traits according to the type of PowerUp
 
Methods inherited from class Obj
getGrid, getX, getY, moveTo, putSelfInGrid, removeSelfFromGrid, setX, setY
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

power

private int power

powerUpImage

private java.awt.image.BufferedImage powerUpImage
Constructor Detail

PowerUp

public PowerUp(Grid gr)
Creates a PowerUp with a random power.

Parameters:
gr - Grid this PowerUp is in

PowerUp

public PowerUp(Grid gr,
               int num)
Creates a PowerUp with given power. If num does not correspond with a power-up value (1 to 4, inclusive), will default to random.

Parameters:
gr -
num -
Method Detail

getPowerUp

public void getPowerUp(Player p)
Given the calling Player, alters the Player's traits according to the type of PowerUp

Parameters:
p - Player picking up this PowerUp

getPowerUp

public int getPowerUp()
Returns the number representing the type of PowerUp this is.

Returns:
number of PowerUp this is

getImage

public java.awt.image.BufferedImage getImage()
Description copied from class: Obj
Returns the image to be drawn in the grid.

Specified by:
getImage in class Obj
Returns:
the image to be drawn.