_cldbearing
Value Type
| numeric [-180-179] |
Description
When a robot collides with an obstacle, the _cldbearing
variable is filled with a bearing to the center of the other object. Robots
can collide with energy missiles, other robots, cookies, mines, and walls. Since
_cldbearing contains a bearing rather than an absolute heading, values are in degrees ranging from -180 to 179 inclusive. A value
of 0 is directly ahead of a robot while -180 is directly behind a robot.
The illustration below shows a robot that is heading 135 degrees when it is hit
by an energy missile. During the collision, the angle to the center of the
energy missile is 45 degrees to the left of the robot's current heading. This produces
a _cldbearing value of -45 degrees. To convert _cldbearing to a
heading, a robot can add _cldbearing to its current
_heading value (135 + -45 given a heading of 90
degrees).

The image also shows that when a robot collides with another object it can obtain the direction the other object was traveling from the _cldheading variable.
See Also
_cldheading, _cldenergy, _cldid, _cldteamid, _cldrobot, _cldmissile, _cldcookie, _cldmine, _cldwall, _heading