|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--objects.DrawableGameObject | +--objects.Ship
A ship. Note that most of the information you need may be available
in the Player
object of the owner of this ship.
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:
Player
Field Summary |
Fields inherited from class objects.DrawableGameObject |
bounds, dir, loc |
Constructor Summary | |
Ship(Player owner)
Constructs a new ship with the given owner. |
Method Summary | |
void |
draw(java.awt.Graphics g)
Draws the object in the given graphic context. |
java.awt.Color |
getColor()
Returns the main color used for drawing this object. |
int |
getPhaserOffset()
Returns the distance from the center of the ship to the cannon. |
boolean |
isHitBy(int x,
int y)
Checks if a point is within this ship. |
boolean |
isHitBy(java.awt.Point p)
Checks if a point is within this ship. |
void |
setColor(java.awt.Color col)
Sets the main color used when drawing this object. |
protected void |
updateBounds()
|
Methods inherited from class objects.DrawableGameObject |
getBounds, getDirection, getDirectionAsShort, getId, getLocation, setDirection, setDirectionFromShort, setId, setLocation, setLocation |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Ship(Player owner)
owner
- the player who controls this ship.Method Detail |
protected final void updateBounds()
updateBounds
in class DrawableGameObject
public final void setColor(java.awt.Color col)
col
- the color.public final java.awt.Color getColor()
public final int getPhaserOffset()
public final boolean isHitBy(int x, int y)
x
- the x-coordinate.y
- the y-coordinate.
true
if the point is considered to
be inside the ship, false
otherwise.public final boolean isHitBy(java.awt.Point p)
p
- the point.
true
if the point is considered to
be inside the ship, false
otherwise.public final void draw(java.awt.Graphics g)
DrawableGameObject
Image
with the size of the entire world,
so the drawing routine doesn't need to displace it's coordinates.
draw
in class DrawableGameObject
g
- the graphic context.DrawableGameObject
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |