|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IStandardRobotPeer
The standard robot peer for standard robot types like Robot
,
AdvancedRobot
, and TeamRobot
.
IBasicRobotPeer
,
IAdvancedRobotPeer
,
ITeamRobotPeer
,
IJuniorRobotPeer
Method Summary | |
---|---|
void |
resume()
Immediately resumes the movement you stopped by stop(boolean) ,
if any. |
void |
setAdjustGunForBodyTurn(boolean independent)
Sets the gun to turn independent from the robot's turn. |
void |
setAdjustRadarForBodyTurn(boolean independent)
Sets the radar to turn independent from the robot's turn. |
void |
setAdjustRadarForGunTurn(boolean independent)
Sets the radar to turn independent from the gun's turn. |
void |
stop(boolean overwrite)
Immediately stops all movement, and saves it for a call to resume() . |
void |
turnRadar(double radians)
Immediately turns the robot's radar to the right or left by radians. |
Methods inherited from interface robocode.robotinterfaces.peer.IBasicRobotPeer |
---|
execute, fire, getBattleFieldHeight, getBattleFieldWidth, getBodyHeading, getBodyTurnRemaining, getCall, getDistanceRemaining, getEnergy, getGraphics, getGunCoolingRate, getGunHeading, getGunHeat, getGunTurnRemaining, getName, getNumRounds, getOthers, getRadarHeading, getRadarTurnRemaining, getRoundNum, getTime, getVelocity, getX, getY, move, rescan, setBodyColor, setBulletColor, setCall, setDebugProperty, setFire, setGunColor, setRadarColor, setScanColor, turnBody, turnGun |
Method Detail |
---|
void stop(boolean overwrite)
resume()
. If there is already movement saved from a previous
stop, you can overwrite it by calling stop(true)
.
overwrite
- If there is already movement saved from a previous stop,
you can overwrite it by calling stop(true)
.resume()
void resume()
stop(boolean)
,
if any.
This call executes immediately, and does not return until it is complete.
stop(boolean)
void turnRadar(double radians)
// Turn the robot's radar 180 degrees to the right turnRadar(Math.PI); // Afterwards, turn the robot's radar 90 degrees to the left turnRadar(-Math.PI / 2);
radians
- the amount of radians to turn the robot's radar.
If radians
> 0 the robot's radar is set to turn right.
If radians
< 0 the robot's radar is set to turn left.
If radians
= 0 the robot's radar is set to stop turning.IBasicRobotPeer.turnBody(double)
,
IBasicRobotPeer.turnGun(double)
,
IBasicRobotPeer.move(double)
void setAdjustGunForBodyTurn(boolean independent)
setAdjustGunForBodyTurn(true)
.
When this is set, the gun will turn independent from the robot's turn,
i.e. the gun will compensate for the robot's body turn.
Note: This method is additive until you reach the maximum the gun can
turn. The "adjust" is added to the amount you set for turning the robot,
then capped by the physics of the game. If you turn infinite, then the
adjust is ignored (and hence overridden).
Example, assuming both the robot and gun start out facing up (0 degrees):
// Set gun to turn with the robot's turn setAdjustGunForBodyTurn(false); // This is the default turnBodyRight(Math.PI / 2); // At this point, both the robot and gun are facing right (90 degrees) turnBodyLeft(Math.PI / 2); // Both are back to 0 degrees -- or -- // Set gun to turn independent from the robot's turn setAdjustGunForBodyTurn(true); turnBodyRight(Math.PI / 2); // At this point, the robot is facing right (90 degrees), but the gun is still facing up. turnBodyLeft(Math.PI / 2); // Both are back to 0 degrees.Note: The gun compensating this way does count as "turning the gun". See
setAdjustRadarForGunTurn(boolean)
for details.
independent
- true
if the gun must turn independent from the
robot's turn; false
if the gun must turn with the robot's turn.setAdjustRadarForGunTurn(boolean)
void setAdjustRadarForGunTurn(boolean independent)
setAdjustRadarForGunTurn(true)
. When this
is set, the radar will turn independent from the robot's turn, i.e. the
radar will compensate for the gun's turn.
Note: This method is additive until you reach the maximum the radar can
turn. The "adjust" is added to the amount you set for turning the robot,
then capped by the physics of the game. If you turn infinite, then the
adjust is ignored (and hence overridden).
Example, assuming both the gun and radar start out facing up (0 degrees):
// Set radar to turn with the gun's turn setAdjustRadarForGunTurn(false); // This is the default turnGunRight(Math.PI / 2); // At this point, both the radar and gun are facing right (90 degrees); -- or -- // Set radar to turn independent from the gun's turn setAdjustRadarForGunTurn(true); turnGunRight(Math.PI / 2); // At this point, the gun is facing right (90 degrees), but the radar is still facing up.Note: Calling
setAdjustRadarForGunTurn(boolean)
will
automatically call setAdjustRadarForBodyTurn(boolean)
with the
same value, unless you have already called it earlier. This behavior is
primarily for backward compatibility with older Robocode robots.
independent
- true
if the radar must turn independent from
the gun's turn; false
if the radar must turn with the gun's
turn.setAdjustRadarForBodyTurn(boolean)
,
setAdjustGunForBodyTurn(boolean)
void setAdjustRadarForBodyTurn(boolean independent)
setAdjustRadarForBodyTurn(true)
. When this is
set, the radar will turn independent from the robot's turn, i.e. the
radar will compensate for the robot's turn.
Note: This method is additive until you reach the maximum the radar can
turn. The "adjust" is added to the amount you set for turning the gun,
then capped by the physics of the game. If you turn infinite, then the
adjust is ignored (and hence overridden).
Example, assuming the robot, gun, and radar all start out facing up (0
degrees):
// Set radar to turn with the robots's turn setAdjustRadarForBodyTurn(false); // This is the default turnRight(Math.PI / 2); // At this point, the body, gun, and radar are all facing right (90 degrees); -- or -- // Set radar to turn independent from the robot's turn setAdjustRadarForBodyTurn(true); turnRight(Math.PI / 2); // At this point, the robot and gun are facing right (90 degrees), but the radar is still facing up.
independent
- true
if the radar must turn independent from
the robots's turn; false
if the radar must turn with the robot's
turn.setAdjustGunForBodyTurn(boolean)
,
setAdjustRadarForGunTurn(boolean)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |