Robot FireBullet 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)
    Bullet bullet = FireBullet(Rules.MAX_BULLET_POWER);

    // Get the velocity of the bullet 
    if (bullet != null)
        double bulletVelocity = bullet.Velocity;
Returns a Bullet That contains information about the bullet if it was actually fired, which can be used for tracking the bullet after it has been fired. If the bullet was not fired, null is returned.

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

public Bullet FireBullet(
	double power


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

Return Value

Type: Bullet
See Also