_accel


Value Type

numeric     [-5-5]

Description

Contains a robot's acceleration rate. This variable has a range of -5 to 5 inclusive. Positive values indicate that a robot's speed is increasing in the forward direction while negative values indicate speed is increasing in the backwards direction. A robot can not directly control its acceleration. Robots can only set a target acceleration rate with the acceltarget command.

The _accel variable actually contains the acceleration rate used to calculate a robot's previous movement rather than the acceleration rate that will be used during a robot's current turn. The happens because the value of _accel is updated each turn just before a robot actually moves, and this occurs after a robot's code has run. Fortunately, the change in _accel between turns is often small or zero so this issue can often be ignored. Although it is difficult for a robot to always predict exactly how far it will move during the current turn.

When older robots call the setaccel command rather than acceltarget, _accel has a range of (-7 to 7). This is to maintain compatibility with older robots and should not be used by new robots.

See Also

acceltarget, deceltarget, speedtarget, _velocity, _acceltarget, _deceltarget, game turns