Robot OnHitWall Method Robocode Robot API for .NET
This method is called when your robot collides with a wall. You should override it in your robot if you want to be informed of this event.

The wall at the top of the screen is 0 degrees, right is 90 degrees, bottom is 180 degrees, left is 270 degrees. But this event is relative to your heading, so: The bearing is such that TurnRight(Double)Bearing will point you perpendicular to the wall.

Examples

void OnHitWall(HitWallEvent evnt)
{
    Out.WriteLine("Ouch, I hit a wall bearing " + evnt.Bearing + " degrees.");
}

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

public virtual void OnHitWall(
	HitWallEvent evnt
)

Implements

IBasicEvents OnHitWall(HitWallEvent)
See Also