|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectSprite
client.brickblock.objects.Powerup
public abstract class Powerup
Abstract class used for power up objects. All
power up objects have an increment value that determines
the effect of the power up,
and can be activated and deactivated.
This class extends the Sprite
, and
power up objects can therefore be placed directly
on the game board (by the LayerManager
.
Field Summary | |
---|---|
protected int |
increment
The value with which the player's affected value is incremented |
Constructor Summary | |
---|---|
protected |
Powerup(java.lang.String imageAddress,
int xPos,
int yPos,
int increment)
Constructor that assigns an image to the power up object, as well as defining a position and duration. |
Method Summary | |
---|---|
abstract void |
activate(BBPlayer player)
"Turns on" the power up by increasing one of the player's attributes. |
static Powerup |
createPowerup(java.lang.String type,
int xPos,
int yPos,
int value)
Creates a power up object with the given attributes. |
abstract void |
deactivate(BBPlayer player)
"Turns off" the power up by restoring the player's attribute to the value it would have had if the power up had not been picked up. |
abstract java.lang.String |
getPowerUpName()
Returns a three letter String representation of the power up object. |
java.lang.Object[] |
getValues()
Returns the attributes of the power up object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int increment
Constructor Detail |
---|
protected Powerup(java.lang.String imageAddress, int xPos, int yPos, int increment) throws java.io.IOException
imageAddress
- The location of the image to use.xPos
- The object's x-position on the screen.yPos
- The object's y-position on the screen.increment
- The increment of the power up.
java.io.IOException
- If the image file is not found.Method Detail |
---|
public abstract void activate(BBPlayer player)
player
- The player that is affected by the power up.public abstract void deactivate(BBPlayer player)
player
- The player that is affected by the power up.public abstract java.lang.String getPowerUpName()
public static Powerup createPowerup(java.lang.String type, int xPos, int yPos, int value)
type
attribute. When new implentors
of this class is created, the list of types in this method needs
to be updated.
type
- The type of power up to create.xPos
- The horizontal position of the object.yPos
- The vertical position of the object.value
- The increment value of the object.
public java.lang.Object[] getValues()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |