Robo Home | Changes | Preferences | AllPages

Time needed to rotate the gun (Targeting) and bullet travel time.

Sample code:

public static double timeToHit(double enemyBearing, double enemyDistance, double gunHeading, double bulletPower) {
    return Math.abs(normalRelativeAngleDiff(enemyBearing,gunHeading))/20+enemyDistance/(20 - 3 * bulletPower);

The first part

calculates time needed to rotate the gun, and the second one
enemyDistance/(20 - 3 * bulletPower)
computes bullet travel time.

Robo Home | Changes | Preferences | AllPages
Edit text of this page | View other revisions
Last edited July 1, 2004 13:40 EST by Ph (diff)