HitByBulletEvent MembersRobocode Robot API for .NET

The HitByBulletEvent type exposes the following members.
Constructors

  NameDescription
Public methodHitByBulletEvent
Called by the game to create a new HitByBulletEvent.
Back to Top
Methods

  NameDescription
Public methodCompareTo
Compares this event to another event regarding precedence.

The event precedence is first and foremost determined by the event time, secondly the event priority, and lastly specific event information.

This method will first compare the time of each event. If the event time is the same for both events, then this method compared the priority of each event. If the event priorities are equals, then this method will compare the two events based on specific event information.

This method is called by the game in order to sort the event queue of a robot to make sure the events are listed in chronological order.

(Inherited from Event.)
Back to Top
Properties

  NameDescription
Public propertyBearing
Returns the bearing to the bullet, relative to your robot's heading, in degrees (-180 < getBearing() <= 180).

If you were to TurnRight(event.Bearing), you would be facing the direction the bullet came from. The calculation used here is: (bullet's heading in degrees + 180) - (your heading in degrees)
Public propertyBearingRadians
Returns the bearing to the bullet, relative to your robot's heading, in radians (-Math.PI < getBearingRadians() <= Math.PI).

If you were to TurnRightRadians(event.BearingRadians), you would be facing the direction the bullet came from. The calculation used here is: (bullet's heading in radians + Math.PI) - (your heading in radians)
Public propertyBullet
Returns the bullet that hit your robot.
Public propertyHeading
Returns the heading of the bullet when it hit you, in degrees (0 <= getHeading() < 360).

Note: This is not relative to the direction you are facing. The robot that fired the bullet was in the opposite direction of getHeading() when it fired the bullet.
Public propertyHeadingRadians
Returns the heading of the bullet when it hit you, in radians (0 <= getHeadingRadians() < 2 * PI).

Note: This is not relative to the direction you are facing. The robot that fired the bullet was in the opposite direction of getHeadingRadians() when it fired the bullet.
Public propertyName
Returns the name of the robot that fired the bullet.
Public propertyPower
Returns the power of this bullet. The damage you take (in fact, already took) is 4 * power, plus 2 * (power-1) if power > 1. The robot that fired the bullet receives 3 * power back.
Public propertyPriority
The priority of this event.

An event priority is a value from 0 - 99. The higher value, the higher priority.

The default priority is 80, but varies depending on the type of event.

(Inherited from Event.)
Public propertyTime
The time when this event occurred.
(Inherited from Event.)
Public propertyVelocity
Returns the velocity of this bullet.
Back to Top
See Also