|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.bytefarmers.droids.models.DroidModel
Class Droid is a simple robot implementation used for simulations and games.
| Field Summary | |
java.awt.Color |
arrowColor
|
java.awt.Color |
borderColor
|
DCosSin |
dcs
|
java.awt.Point |
defaultLocation
|
int |
direction
|
java.awt.Color |
droidColor
|
java.awt.Point |
location
|
int |
radius
|
java.awt.Point |
target
|
Trajectory |
trajectory
|
int |
velocity
|
| Constructor Summary | |
DroidModel()
Creates a new instance of Droid at default position |
|
DroidModel(int x,
int y)
Creates a new instance of Droid at x,y |
|
| Method Summary | |
int |
getAngleTo(java.awt.Point targetPoint)
return angle to a specified location. |
java.awt.Point |
getBorderLocation(int d)
get the outer Point (X,Y set) from the Circle shaped Droid. |
java.awt.Point |
getBorderLocation(int d,
int r)
get the outer Point (X,Y set) from the Circle shaped Droid. |
java.awt.Point |
getDefaultLocation()
Returns Droid Default Location (x,y), generally the start position, but can be changed.. |
int |
getDirection()
Returns Droid direction (d) |
int |
getDistanceTo(java.awt.Point targetPoint)
get distance to a specified point |
java.awt.Point |
getLocation()
Returns Droid location (x,y) |
int |
getRadius()
Returns Droid radius |
java.awt.Point |
getTarget()
Returns Droid target (x,y) |
int |
getVelocity()
Returns Droid Velocity (v) |
int |
getX()
Returns Droid X location |
int |
getY()
Returns Droid Y location |
java.awt.Point |
moveDirection(int degreeAngle,
int distance)
move a specified direction and length |
java.awt.Point |
moveTowards(java.awt.Point targetPoint,
int moveDistance)
move towards a point |
void |
render(java.awt.Graphics2D g2d)
render object onto viewport |
void |
setDefaultLocation(java.awt.Point p)
Set Droid Default Location (x,y) |
void |
setDirection(int d)
Set new Droid direction (d) |
void |
setLocation(int x,
int y)
Set new Droid location (x,y) |
void |
setLocation(java.awt.Point p)
Set Droid location (x,y) |
void |
setRadius(int r)
Set new Droid radius |
void |
setTarget(java.awt.Point location)
Set Droid target (x,y) |
void |
setVelocity(int v)
Set Droid Velocity (v) |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public java.awt.Point location
public java.awt.Point defaultLocation
public java.awt.Color borderColor
public java.awt.Color droidColor
public java.awt.Color arrowColor
public int radius
public int direction
public int velocity
public java.awt.Point target
public DCosSin dcs
public Trajectory trajectory
| Constructor Detail |
public DroidModel()
public DroidModel(int x,
int y)
x - x positiony - y position| Method Detail |
public java.awt.Point getLocation()
public void setLocation(java.awt.Point p)
p - source point
public void setLocation(int x,
int y)
x - X-coordinatey - Y-coordinatepublic int getX()
public int getY()
public java.awt.Point getDefaultLocation()
public void setDefaultLocation(java.awt.Point p)
p - source pointpublic java.awt.Point getTarget()
public void setTarget(java.awt.Point location)
location - source pointpublic java.awt.Point getBorderLocation(int d)
d - Degrees
public java.awt.Point getBorderLocation(int d,
int r)
d - Degreesr - radius (optional)
public int getDirection()
public void setDirection(int d)
d - degree (0-359)public int getRadius()
public void setRadius(int r)
r - radiuspublic int getVelocity()
public void setVelocity(int v)
v - Velocitypublic void render(java.awt.Graphics2D g2d)
g2d - Graphics2S viewport
public java.awt.Point moveDirection(int degreeAngle,
int distance)
degreeAngle - direction angledistance - move distance
public java.awt.Point moveTowards(java.awt.Point targetPoint,
int moveDistance)
targetPoint - move towards this target pointmoveDistance - move distance
public int getAngleTo(java.awt.Point targetPoint)
targetPoint - taret point
public int getDistanceTo(java.awt.Point targetPoint)
targetPoint - target point
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||