IAdvancedRobotPeer SetTurnGun Method Robocode Robot API for .NET
Sets the robot's gun to turn right or left by radians when the next execution takes place.

This call returns immediately, and will not execute until you call Execute  or take an action that executes.

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

Examples

// Set the robot's gun to turn 180 degrees to the right
SetTurnGun(Math.PI);

// Set the robot's gun to turn 90 degrees to the left instead of right 
// (overrides the previous order)
SetTurnGun(-Math.PI / 2);

...
// Executes the last setTurnFun()
Execute();

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

void SetTurnGun(
	double radians
)

Parameters

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