|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object
|
+--giavamachia.MobileObject
|
+--giavamachia.Robot
Each playable Robot must subclass this class and
implement method run().
MobileObject,
Runnable| Constructor Summary | |
|
Robot()
Creates a new Robot instance. |
protected |
Robot(java.awt.Point p)
Creates a new Robot instance. |
| Method Summary | |
int |
actualDirection()
The actual direction of the Robot. |
double |
actualDirectionInRad()
The actual direction of the Robot. |
java.awt.Point |
actualPosition()
The actual position of the Robot in the
Arena |
int |
actualSpeed()
The actual speed of the Robot. |
protected void |
fireBomb(int direction,
int distance)
If Robot is readyToFire(), it fires a
bomb addressing a target far distance units in
direction direction. |
protected void |
fireLaser()
If Robot is readyToFire(), it fires a
lasers addressing a target in direction
actualDirection(). |
protected void |
fireMissile(int direction)
If Robot is readyToFire(), it fires a
missile addressing a target in direction
direction. |
protected int |
getStamina()
It returns the vitality of the Robot. |
protected int |
getTemperature()
It returns the temperature of the Robot. |
protected View |
look(int direction)
Looks into direction searching for enemies and
mines. |
java.lang.String |
name()
The name of the Robot. |
protected void |
putMine(int time)
If Robot is readyToFire() and
time is greater than zero, it drops a mine that is
going to explode time clock ticks later. |
protected boolean |
readyToFire()
|
protected void |
run(int dir,
int sp)
Turn the Robot in direction dir and
change its speed. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.lang.Runnable |
run |
| Constructor Detail |
protected Robot(java.awt.Point p)
Robot instance.p - Point of creationpublic Robot()
Robot instance.| Method Detail |
public final java.lang.String name()
Robot.String containing the name of the robot.protected final boolean readyToFire()
protected final View look(int direction)
direction searching for enemies and
mines. Scope is a slice of
Consts.ROBOT_LOOK_SPREAD degrees of opening and
Consts.ROBOT_LOOK_RANGE of radius. It returns the
set of objects seen. FIXME: it returns only robots.direction - degrees: starting at three o'clock,
counter-clockwise.Observationsprotected final void putMine(int time)
Robot is readyToFire() and
time is greater than zero, it drops a mine that is
going to explode time clock ticks later. It
increase Robot temperature by
Consts.MINE_POWER degrees.time - clock ticks before explosion
protected final void fireBomb(int direction,
int distance)
Robot is readyToFire(), it fires a
bomb addressing a target far distance units in
direction direction. It increases Robot
temperature by Consts.BOMB_POWER degrees.direction - degrees: starting at three o'clock,
counter-clockwise. The method has no effect if
direction is less than 0 or greater than 360.distance - distance of the targetprotected final void fireMissile(int direction)
Robot is readyToFire(), it fires a
missile addressing a target in direction
direction. It increases Robot
temperature by Consts.MISSILE_POWER degrees.direction - degrees: starting at three o'clock,
counter-clockwise. The method has no effect if
direction is less than 0 or greater than 360.protected final void fireLaser()
Robot is readyToFire(), it fires a
lasers addressing a target in direction
actualDirection(). It increases Robot
temperature by Consts.LASER_POWER degrees.
protected final void run(int dir,
int sp)
Robot in direction dir and
change its speed.dir - degrees: starting at three o'clock,
counter-clockwise. The method has no effect if
dir is less than 0 or greater than 360.sp - new speed. The method pass control to the scheduler
if sp is less than 0 or greater than
Consts.ROBOT_MAX_SPEED.protected final int getStamina()
Robot.Robot is dead.protected final int getTemperature()
Robot.int value between 0 and
Robot.Consts.MAX_TEMPpublic final java.awt.Point actualPosition()
Robot in the
ArenaPoint with coordinates of the
Robot. The origin is the center of the
Arena, x goes left to right,
y goes bottom-up. Max x is
Consts.DIMX/2, max y is
Consts.DIMY/2public final int actualSpeed()
Robot.public final int actualDirection()
Robot.public final double actualDirectionInRad()
Robot.
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||