|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectserver.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.
Field Summary | |
---|---|
static int |
DEFAULT_DURATION_SECS
|
static int |
DEFAULT_SIZE
|
Constructor Summary | |
---|---|
protected |
Powerup(int xPos,
int yPos,
int duration)
Constructor that assigns a position to the power up object, as well as defining the duration. |
Method Summary | |
---|---|
abstract void |
activate(BBPlayer player)
"Turns on" the power up by increasing one of the player's 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.Object |
getAffectedAttribute(BBPlayer player)
Returns the player attribute that is affected by the power up object, i.e. speed, size, or strength. |
java.lang.String[] |
getAttributes()
Returns the power up's attribues, i.e. the power up's type, position, and increment value. |
int |
getDuration()
Returns the duration of the power up. |
abstract int |
getIncrement()
Returns the power up's increment value, i.e. how much the player's affected attribute is incremented when picking up the power up. |
abstract java.lang.String |
getName()
Returns a three letter String representation of the power up object. |
int[] |
getPosition()
|
long |
getTimeout()
|
void |
setDuration(int duration)
Sets the duration of the power up to the specified value. |
void |
setPosition(int xPos,
int yPos)
Sets the position of the power up. |
void |
setTimeout(long timeout)
Sets the time for when this power up will no longer remain active for the player that has picked it up. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_SIZE
public static final int DEFAULT_DURATION_SECS
Constructor Detail |
---|
protected Powerup(int xPos, int yPos, int duration)
xPos
- The object's x-position on the screen.yPos
- The object's y-position on the screen.duration
- How long the power up remains active.Method Detail |
---|
public void setPosition(int xPos, int yPos)
xPos
- The object's x-position.yPos
- The object's y-position.public int[] getPosition()
public int getDuration()
public void setDuration(int duration)
duration
- The power up's duration.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.Object getAffectedAttribute(BBPlayer player)
player
- A BBPlayer
object.
public java.lang.String[] getAttributes()
public abstract java.lang.String getName()
public void setTimeout(long timeout)
timeout
- When the power up is deactivated.public long getTimeout()
public abstract int getIncrement()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |