Skip to content

Instantly share code, notes, and snippets.

@grifdail
Created December 7, 2012 12:58
Show Gist options
  • Save grifdail/4233107 to your computer and use it in GitHub Desktop.
Save grifdail/4233107 to your computer and use it in GitHub Desktop.
George washington
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(10);
robot.turn(10);
console.log(robot)
robot.rotateCannon(-robot.cannonRelativeAngle);
};
Robot.prototype.onScannedRobot = function(ev) {
var robot = ev.robot;
var enemy = ev.scannedRobot;
robot.fire();
//robot.turn(robot.cannonRelativeAngle)
};
Robot.prototype.onHitByBullet = function(ev) {
var robot = ev.robot
//robot.clone()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment