Skip to content

Instantly share code, notes, and snippets.

@grifdail
Created December 7, 2012 13:40
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 grifdail/4233338 to your computer and use it in GitHub Desktop.
Save grifdail/4233338 to your computer and use it in GitHub Desktop.
Marvin
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
//robot.clone()
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(10);
robot.rotateCannon(5);
};
Robot.prototype.onScannedRobot = function(ev) {
var robot = ev.robot;
var enemy = ev.scannedRobot;
robot.stop()
robot.fire();
robot.turn(robot.angle-robot.cannonAbsoluteAngle)
//robot.rotateCannon(-robot.cannonRelativeAngle)
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment