rc.yoda.utils
Class Gun

java.lang.Object
  extended by rc.yoda.utils.Gun
Direct Known Subclasses:
Circular, Electrum, HeadOn, Linear, Random, Shoto

public class Gun
extends java.lang.Object

Gun - A class that defines the events a robocode gun can use

Version:
v 1.1
Author:
Robert Codd

Constructor Summary
Gun(robocode.AdvancedRobot robot)
          Class Constructor specifying the robot this gun is virtually mounted on
 
Method Summary
 double getBulletPower()
          getBulletPower - called by the gun array to get the desired bullet power for this gun
 double getFireAngle()
          getFireAngle - called by the gun array to get the desired firing angle for this gun angle 0.0: means directly at the enemy
 void onBulletHit(robocode.BulletHitEvent e)
          onBulletHit - called by robocode when one of our bullets hit the enemy
 void onBulletHitBullet(robocode.BulletHitBulletEvent e)
          onBulletHitBullet - called by robocode when one of our bullets hits an enemy bullet
 void onBulletMissed(robocode.BulletMissedEvent e)
          onBulletMissed - called by robocode when one of our bullets hit a wall
 void onDeath(robocode.DeathEvent e)
          onDeath - called by robocode when our robot dies
 void onPaint(java.awt.Graphics2D g)
          onPaint - called by robocode when our robot can draw to the screen
 void onScannedRobot(robocode.ScannedRobotEvent e)
          onScannedRobot - called by robocode when our robot scans the enemy
 void onWin(robocode.WinEvent e)
          onWin - called by robocode when our robot wins a round
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Gun

public Gun(robocode.AdvancedRobot robot)
Class Constructor specifying the robot this gun is virtually mounted on

Method Detail

onScannedRobot

public void onScannedRobot(robocode.ScannedRobotEvent e)
onScannedRobot - called by robocode when our robot scans the enemy

Parameters:
ScannedRobotEvent - - enemy information

onBulletHit

public void onBulletHit(robocode.BulletHitEvent e)
onBulletHit - called by robocode when one of our bullets hit the enemy

Parameters:
ScannedRobotEvent - - enemy information

onBulletMissed

public void onBulletMissed(robocode.BulletMissedEvent e)
onBulletMissed - called by robocode when one of our bullets hit a wall

Parameters:
onBulletMissed - - missed bullet info

onBulletHitBullet

public void onBulletHitBullet(robocode.BulletHitBulletEvent e)
onBulletHitBullet - called by robocode when one of our bullets hits an enemy bullet

Parameters:
BulletHitBulletEvent - - colliding bullet information

onDeath

public void onDeath(robocode.DeathEvent e)
onDeath - called by robocode when our robot dies

Parameters:
DeathEvent -

onWin

public void onWin(robocode.WinEvent e)
onWin - called by robocode when our robot wins a round

Parameters:
onWin -

onPaint

public void onPaint(java.awt.Graphics2D g)
onPaint - called by robocode when our robot can draw to the screen

Parameters:
Graphic2D - - painting tool

getFireAngle

public double getFireAngle()
getFireAngle - called by the gun array to get the desired firing angle for this gun angle 0.0: means directly at the enemy


getBulletPower

public double getBulletPower()
getBulletPower - called by the gun array to get the desired bullet power for this gun