fire( energy )
Parameters
| Type | Description | |
| energy | numeric | amount to energy to use (1-7) |
_result
Not set.
Descriptions
Fires an energy missile in the direction of the robot's gun. The amount of damage done by an energy missile is proportional to the amount of energy used to fire it and the distance the missile travels before impact. Energy used to fire a missile is removed from the robot's own energy store. Valid values for energy are from 1 to 7 inclusive. Using an energy value that is either zero or greater than a robot's current energy store causes nothing to happen, negative numbers cause an error, and values greater that 7 are simply reduced to 7.
A missile's initial energy is determined by multiplying the energy value passed to fire by 4. As a missile travels it looses energy at a rate of 1 every 45 units moved. No matter how far a missile travels, however, its energy will not go below 4. Therefore the damage done to another robot will never go below 5 since one point is also lost due to the collision. See missile attributes for more information.
The maximum distance a missile can travel before exploding is control by the missile range setting of a match. Missile range is set under that Advanced tab of the New Match window. A robot can determine the maximum missile range for the current match by examining the _missilerange system variable.
After firing an energy missile, a robot's gun requires time to cool before another missile can be fired. The fire command may be called continuously, but nothing will happen until the gun cools to zero. The formula used to calculate initial gun heat is:
(2 * energy) + 12
Each turn a robot's gun cools by one. The _gunheat variable can be used to determine the current heat of the gun, although many robots ignore this and just call fire repeatedly.
See Also