IBasicRobotPeer TurnBody Method Robocode Robot API for .NET
Immediately turns the robot's body to the right or left by radians. This call executes immediately, and does not return until it is complete, i.e. when the angle remaining in the body's turn is 0.

Note that both positive and negative values can be given as input, where positive values means that the robot's body is set to turn right, and negative values means that the robot's body is set to turn left. If 0 is given as input, the robot's body will stop turning.

Examples

// Turn the robot's body 180 degrees to the right
TurnBody(Math.PI);

// Afterwards, turn the robot's body 90 degrees to the left
TurnBody(-Math.PI / 2);

Namespace: Robocode.RobotInterfaces.Peer
Assembly: robocode (in robocode.dll) Version: 1.9.2.0
Syntax

void TurnBody(
	double radians
)

Parameters

radians
Type: OnlineSystem Double
The amount of radians to turn the robot's body. If radians > 0 the robot's body is set to turn right. If radians < 0 the robot's body is set to turn left. If radians = 0 the robot's body is set to stop turning.
See Also