client.brickblock.fwimpl
Class BBPlayer

java.lang.Object
  extended by client.framework.models.AbstractPlayer
      extended by client.brickblock.fwimpl.BBPlayer
All Implemented Interfaces:
Comparable

public class BBPlayer
extends AbstractPlayer

BrickBlock's AbstractPlayer implemention. In addition to the attributes and functionality found in AbstractPlayer, this class contains information about the player's strength and screen resolution. In addition, this class offers functionality for handling a player's bonuses in terms of active Powerup objects.

Author:
Martin Jarrett, Eivind Sorteberg

Constructor Summary
BBPlayer(java.lang.String id)
          Yet another constructor that creates a nameless player.
BBPlayer(java.lang.String id, java.lang.String name)
          Constructor that corresponds to the super constructor.
BBPlayer(java.lang.String id, java.lang.String name, int strength)
          Constructor for BBPlayer.
 
Method Summary
 int getStrength()
          Returns the player's strength.
 void pickupPowerup(Powerup powerup)
          Called when the player picks up a Powerup object.
 void removePowerup(java.lang.String type, int posX, int posY)
          Deactivates the power up indicated by given attributes and removes it from the player object's list of active power ups.
 void setStrength(int strength)
          Sets the player's strength to the value given as input parameter.
 
Methods inherited from class client.framework.models.AbstractPlayer
compareTo, equals, getAttributeValues, getColor, getId, getName, getPosition, getScore, getScreenResolution, getSize, getSpeed, getSprite, getTeam, isReady, move, move, resetMovement, setAttributeValues, setColor, setImage, setName, setPosition, setReady, setScore, setScreenResolution, setSize, setSpeed, setTeam, setTeamColor, setX, setY, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BBPlayer

public BBPlayer(java.lang.String id,
                java.lang.String name,
                int strength)
Constructor for BBPlayer. This contructor takes the player's strength as input parameter in addition to the parameters from the super constructor.

Parameters:
id - The player's network id.
name - The player's name.
strength - The player's strength.

BBPlayer

public BBPlayer(java.lang.String id,
                java.lang.String name)
Constructor that corresponds to the super constructor. This creates a BBPlayer objects with a default strength of 2.

Parameters:
id - The player's id.
name - The player's name.

BBPlayer

public BBPlayer(java.lang.String id)
Yet another constructor that creates a nameless player.

Parameters:
id - The player's id.
Method Detail

getStrength

public int getStrength()
Returns the player's strength.

Returns:
The player's strength.

setStrength

public void setStrength(int strength)
Sets the player's strength to the value given as input parameter.

Parameters:
strength - The player's strength.

pickupPowerup

public void pickupPowerup(Powerup powerup)
Called when the player picks up a Powerup object. The power up is activated, and remains active until the server notifies that the power up has been deactivated.

Parameters:
powerup - The Powerup picked up.
See Also:
BBBoard.handleObjectCollision(Object, int[])

removePowerup

public void removePowerup(java.lang.String type,
                          int posX,
                          int posY)
Deactivates the power up indicated by given attributes and removes it from the player object's list of active power ups. Called when the server has determined that the power up has timed out.

Parameters:
type - The power up type.
posX - The horizontal position of the power up.
posY - The vertical position of the power up.
See Also:
BrickBlock.notifyAboutSpecialActionReceived(client.framework.models.AbstractPlayer, String, String[][]), Powerup.getPowerUpName()