Robot Fire Method Robocode Robot API for .NET
Immediately fires a bullet. The bullet will travel in the direction the gun is pointing.

The specified bullet power is an amount of energy that will be taken from the robot's energy. Hence, the more power you want to spend on the bullet, the more energy is taken from your robot.

The bullet will do (4 * power) damage if it hits another robot. If power is greater than 1, it will do an additional 2 * (power - 1) damage. You will get (3 * power) back if you hit the other robot. You can call GetBulletDamage(Double) for getting the damage that a bullet with a specific bullet power will do.

The specified bullet power should be between MIN_BULLET_POWER and MAX_BULLET_POWER.

Note that the gun cannot Fire if the gun is overheated, meaning that GunHeat returns a value > 0.

A event is generated when the bullet hits a robot (BulletHitEvent), wall (BulletMissedEvent), or another bullet (BulletHitBulletEvent).


// Fire a bullet with maximum power if the gun is ready 
if (GetGunHeat() == 0)

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

public void Fire(
	double power


Type: OnlineSystem Double
The amount of energy given to the bullet, and subtracted from the robot's energy.
See Also