### robocode

# Class BulletHitEvent

- `java.lang.Object`
- - `robocode.Event`
  - - `robocode.BulletHitEvent`

Implemented Interfaces:
  Comparable, Serializable

`public final class BulletHitEvent`
`extends Event`

This event is sent to `onBulletHit` when one of your bullets has hit another robot.

Author:
  Mathew A. Nelson (original)

  ## Constructor Summary

  `BulletHitEvent(String name, double energy, Bullet bullet)`
    Called by the game to create a new `BulletHitEvent`.

  ## Method Summary

  `@Deprecated`

  `String getRobotName()`
    Deprecated. Use `getName()` instead.

  `@Deprecated`

  `double getLife()`
    Deprecated. Use `getEnergy()` instead.

  `@Deprecated`

  `double getRobotLife()`
    Deprecated. Use `getEnergy()` instead.

  `Bullet`

  `getBullet()`
    Returns the bullet of yours that hit the robot.

  `double`

  `getEnergy()`
    Returns the remaining energy of the robot your bullet has hit (after the damage done by your bullet).

  `String`

  `getName()`
    Returns the name of the robot your bullet hit.

  ### Methods inherited from class robocode.Event

  `compareTo`, `getPriority`, `getTime`

## Constructor Details

### BulletHitEvent

    public BulletHitEvent(String name,
                          double energy,
                          Bullet bullet)

> Called by the game to create a new `BulletHitEvent`.
> Parameters:
>   `name` - the name of the robot your bullet hit
>   `energy` - the remaining energy of the robot that your bullet has hit
>   `bullet` - the bullet that hit the robot

## Method Details

### String getRobotName

    public @Deprecated String getRobotName()

> Deprecated. Use `getName()` instead.

> Returns:
>   the name of the robot your bullet hit.

### double getLife

    public @Deprecated double getLife()

> Deprecated. Use `getEnergy()` instead.

> Returns:
>   energy the remaining energy of the robot that your bullet has hit

### double getRobotLife

    public @Deprecated double getRobotLife()

> Deprecated. Use `getEnergy()` instead.

> Returns:
>   energy the remaining energy of the robot that your bullet has hit

### getBullet

    public Bullet getBullet()

> Returns the bullet of yours that hit the robot.
> Returns:
>   the bullet that hit the robot

### getEnergy

    public double getEnergy()

> Returns the remaining energy of the robot your bullet has hit (after the damage done by your bullet).
> Returns:
>   energy the remaining energy of the robot that your bullet has hit

### getName

    public String getName()

> Returns the name of the robot your bullet hit.
> Returns:
>   the name of the robot your bullet hit.