|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--objects.Player
This is a player class. It contains information on a player that currently attends to the game.
If you write a user defined client, you should not try change this object by calling any of it's setter methods, as it will make your view of the game different from all the other players' views.
Also note that for clients, not all getter methods return usable results, as the server doesn't send everything across. The following information is, however, updated and usable for this class:
Constructor Summary | |
Player()
Constructs a new player with the default settings. |
|
Player(short id,
java.lang.String name)
Constructs a new player with the given id and name. |
Method Summary | |
void |
decBombsLeft(int sub)
Decreases the number of bombs left by the given number. |
void |
decDamage(int sub)
Decreases the damage by the given amount. |
void |
decPhaserHeat(int sub)
Decreases phaser heat by the given amount, making sure it doesn't get below zero. |
int |
getAntiScore()
Returns the number of times this player has been killed. |
int |
getBombsLeft()
Gets the number of available targeting bombs. |
int |
getDamage()
Gets the current damage level. |
double |
getDirection()
Returns the direction of this object in radians. |
short |
getDirectionAsShort()
Returns the direction of this object in radians, encoded in a short for transfer to the game server. |
short |
getId()
Fetches the ID of this player. |
java.awt.Point |
getLocation()
Fetches the location of this player within the world. |
java.lang.String |
getName()
Fetches the name of this player. |
int |
getPhaserHeat()
Gets the current phaser heat value. |
int |
getRatio()
Gets a ratio between the number of kills and the number of times being killed. |
java.lang.String |
getRatioString()
Creates a string that describes the ratio between the number of kills and the number of times killed. |
int |
getScore()
Fetches the number of kills done by this player. |
Ship |
getShip()
Returns the Ship object that is controlled by this
player. |
void |
incAntiScore()
Increases the number of times this player has been killed. |
void |
incBombsLeft(int add)
Increases the number of bombs left by the given number. |
void |
incDamage(int add)
Increases the damage by the given amount. |
void |
incPhaserHeat(int add)
Increases phaser heat by the given amount, making sure it doesn't get above 100. |
void |
incScore()
Increases the number of kills done by this player. |
boolean |
isAlive()
Checks if this player is dead or alive. |
boolean |
isInView(DrawableGameObject o)
|
boolean |
isPhaserOverheated()
Checks if the phaser cannon is currently overheated. |
void |
setAlive(boolean alive)
Sets whether this player is alive. |
void |
setAntiScore(int antiScore)
Sets the number of times this player has been killed. |
void |
setBombsLeft(int bombsLeft)
Sets the available number of targeting bombs. |
void |
setDamage(int damage)
Sets the damage level of this player. |
void |
setDirection(double angle)
Sets the direction of this object as an angle in radians. |
void |
setDirectionFromShort(short angle)
Sets the direction of this object, encoded as a short, as sent from the game server. |
void |
setId(short id)
Sets the ID of this player. |
void |
setLocation(int x,
int y)
Sets the location of this object within the world. |
void |
setLocation(java.awt.Point loc)
Sets the location of this object within the world. |
void |
setName(java.lang.String name)
Sets the name of this player. |
void |
setPhaserHeat(int phaserHeat)
Sets the phaser cannon heat percent of this player. |
void |
setScore(int score)
Sets the current score. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Player()
public Player(short id, java.lang.String name)
id
- the ID of this player.name
- the name.Method Detail |
public final void setId(short id)
id
- the ID of this player.public final short getId()
public final void setName(java.lang.String name)
name
- the name.public final java.lang.String getName()
public final void setScore(int score)
score
- the new score.public final void incScore()
public final int getScore()
public void setLocation(java.awt.Point loc)
Ship
object.
loc
- the location.Ship
public void setLocation(int x, int y)
Ship
object.
x
- the x-coordinate.y
- the y-coordinate.Ship
public final java.awt.Point getLocation()
Ship
object.
Ship
public final void setDirection(double angle)
Ship
object.
angle
- the angle in radians.Ship
public final double getDirection()
Ship
object.
Ship
public final void setDirectionFromShort(short angle)
Ship
object.
angle
- the angle encoded as a short.Ship
public final short getDirectionAsShort()
Ship
object.
Ship
public final Ship getShip()
Ship
object that is controlled by this
player.
Ship
object.public final void setAlive(boolean alive)
alive
- true
to indicate that the player
is alive, false
to indicate that
he/she is dead.public final boolean isAlive()
true
if the player is alive,
false
otherwise.public final void setDamage(int damage)
damage
- the damage level.public final void incDamage(int add)
add
- the amount to add.public final void decDamage(int sub)
sub
- the amount to subtract.public final int getDamage()
public final void setPhaserHeat(int phaserHeat)
phaserHeat
- the phaser heat value.public final void incPhaserHeat(int add)
add
- the number to add.public final void decPhaserHeat(int sub)
sub
- the number to subtract.public final int getPhaserHeat()
public final boolean isPhaserOverheated()
true
if overheated,
false
otherwise.public final void setBombsLeft(int bombsLeft)
bombsLeft
- the number of bombs.public final void incBombsLeft(int add)
add
- the number to add.public final void decBombsLeft(int sub)
sub
- the number to subtract.public final int getBombsLeft()
public final void setAntiScore(int antiScore)
antiScore
- the number of times killed.public final void incAntiScore()
public final int getAntiScore()
public final int getRatio()
public final java.lang.String getRatioString()
public final boolean isInView(DrawableGameObject o)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |