Class OwnSpaceCraft

java.lang.Object
  extended bySpaceCraft
      extended byOwnSpaceCraft

public class OwnSpaceCraft
extends SpaceCraft

Author:
bachmaer Maintains state of the users on SpaceCraft.

Field Summary
(package private) static int INCREMENT
           
(package private) static java.util.Random rand
           
 
Fields inherited from class SpaceCraft
heading, ID, IDport, xPosition, yPosition
 
Constructor Summary
OwnSpaceCraft(int port)
          Creates OwnSpaceCraft with random position and heading.
 
Method Summary
 void draw(java.awt.Graphics g)
          Draws the SpaceCraft in white as a arrow point oriented in the heading direction.
 void leftTurn()
          Increments the heading 90 degrees to the left.
 void move()
          Move OwnsSpaceCraft ahead one increment in the direstion in which it is headed.
 void rightTurn()
          Increments the heading 90 degrees to the right.
 
Methods inherited from class SpaceCraft
equals, getHeading, getXPosition, getYPosition, setHeading, setX, setY, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

rand

static java.util.Random rand

INCREMENT

static final int INCREMENT
See Also:
Constant Field Values
Constructor Detail

OwnSpaceCraft

public OwnSpaceCraft(int port)
Creates OwnSpaceCraft with random position and heading.

Method Detail

move

public void move()
Move OwnsSpaceCraft ahead one increment in the direstion in which it is headed. Spacecraft is stopped at the edge of the world.


rightTurn

public void rightTurn()
Increments the heading 90 degrees to the right.


leftTurn

public void leftTurn()
Increments the heading 90 degrees to the left.


draw

public void draw(java.awt.Graphics g)
Draws the SpaceCraft in white as a arrow point oriented in the heading direction.

Overrides:
draw in class SpaceCraft
Returns:
current x position