Skip to content

Instantly share code, notes, and snippets.

@siminino
Created December 3, 2012 15:40
Show Gist options
  • Save siminino/4195789 to your computer and use it in GitHub Desktop.
Save siminino/4195789 to your computer and use it in GitHub Desktop.
SimininoDroid #2
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
var contSimi = 1;
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.fire()
robot.ahead(contSimi*100);
robot.fire();
robot.rotateCannon(340);
robot.turn(90);
robot.fire();
robot.back(contSimi*150);
robot.fire();
robot.rotateCannon(200);
if (contSimi < 10) {
contSimi += 1;
} else {
contSimi -= 1;
}
robot.position.x = 10;
};
Robot.prototype.onScannedRobot = function(ev) {
var robot = ev.robot;
robot.fire();
robot.fire();
robot.fire();
robot.fire();
robot.fire();
robot.fire();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment