Skip to content

Instantly share code, notes, and snippets.

@mrspeaker
Created January 26, 2011 19:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrspeaker/797296 to your computer and use it in GitHub Desktop.
Save mrspeaker/797296 to your computer and use it in GitHub Desktop.
onRobotScanned: function(enemy) {
var angle = enemy.bearing - this.gunBearing
angle = angle < -180 ? 360 + angle : angle
this.turnGunRight(angle)
this.state = 'lock'
if(Math.abs(angle) <= 1 && this.energy > 10) {
this.fire(enemy.velocity < 1 ? 4 : 1)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment