JuniorRobot PropertiesRobocode Robot API for .NET
The JuniorRobot type exposes the following members.
Properties

  NameDescription
Public propertyEnergy
Current energy of this robot, where 100 means full energy and 0 means no energy (dead).
Public propertyFieldHeight
Contains the height of the battlefield.
Public propertyFieldWidth
Contains the width of the battlefield.
Public propertyGunBearing
Current gun heading angle of this robot compared to its body (in degrees).
Public propertyGunHeading
Current gun heading angle of this robot (in degrees).
Public propertyHeading
Current heading angle of this robot (in degrees).
Public propertyHitByBulletAngle
Latest angle from where this robot was hit by a bullet (in degrees). If the robot has never been hit, this field will be less than 0, i.e. -1. This field will not be updated while OnHitByBullet  event is active.
Public propertyHitByBulletBearing
Latest angle from where this robot was hit by a bullet (in degrees) compared to the body of this robot. If the robot has never been hit, this field will be less than 0, i.e. -1. This field will not be updated while OnHitByBullet  event is active.
Public propertyHitRobotAngle
Latest angle where this robot has hit another robot (in degrees). If this robot has never hit another robot, this field will be less than 0, i.e. -1. This field will not be updated while OnHitRobot  event is active.
Public propertyHitRobotBearing
Latest angle where this robot has hit another robot (in degrees) compared to the body of this robot. If this robot has never hit another robot, this field will be less than 0, i.e. -1. This field will not be updated while OnHitRobot  event is active.
Public propertyHitWallAngle
Latest angle where this robot has hit a wall (in degrees). If this robot has never hit a wall, this field will be less than 0, i.e. -1. This field will not be updated while OnHitWall  event is active.
Public propertyHitWallBearing
Latest angle where this robot has hit a wall (in degrees) compared to the body of this robot. If this robot has never hit a wall, this field will be less than 0, i.e. -1. This field will not be updated while OnHitWall  event is active.
Public propertyIsGunReady
Flag specifying if the gun is ready to Fire, i.e. gun heat <= 0. true means that the gun is able to Fire; false means that the gun cannot Fire yet as it still needs to cool down.
Public propertyOthers
Current number of other robots on the battle field.
Public propertyOut
The Out stream your robot should use to print.

You can view the print-outs by clicking the button for your robot in the right side of the battle window.

Examples

// Print Out a line each time my robot hits another robot 
public void OnHitRobot(HitRobotEvent e)
{
    Out.WriteLine("I hit a robot!  My energy: " + Energy + " his energy: " + e.Energy);
}
Public propertyRobotX
Current horizontal location of this robot (in pixels).
Public propertyRobotY
Current vertical location of this robot (in pixels).
Public propertyScannedAngle
Current angle to the scanned nearest other robot (in degrees). If there is no robot in the radar's sight, this field will be less than 0, i.e -1. This field will not be updated while OnScannedRobot  event is active.
Public propertyScannedBearing
Current angle to the scanned nearest other robot (in degrees) compared to the body of this robot. If there is no robot in the radar's sight, this field will be less than 0, i.e -1. This field will not be updated while OnScannedRobot  event is active.
Public propertyScannedDistance
Current distance to the scanned nearest other robot (in pixels). If there is no robot in the radar's sight, this field will be less than 0, i.e -1. This field will not be updated while OnScannedRobot  event is active.
Public propertyScannedEnergy
Current energy of scanned nearest other robot. If there is no robot in the radar's sight, this field will be less than 0, i.e -1. This field will not be updated while OnScannedRobot  event is active.
Public propertyScannedHeading
Current heading of the scanned nearest other robot (in degrees). If there is no robot in the radar's sight, this field will be less than 0, i.e -1. This field will not be updated while OnScannedRobot  event is active.
Public propertyScannedVelocity
Current velocity of the scanned nearest other robot. If there is no robot in the radar's sight, this field will be -99. Note that a positive value means that the robot moves forward, a negative value means that the robot moved backward, and 0 means that the robot is not moving at all. This field will not be updated while OnScannedRobot  event is active.
Back to Top
See Also