-
-
Save Firvagor/4204827 to your computer and use it in GitHub Desktop.
Sperminator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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(1); | |
robot.rotateCannon(360); | |
robot.ahead(1); | |
//robot.back(1000); | |
// robot.rotateCannon(360); | |
// robot.turn(20); | |
}; | |
Robot.prototype.onScannedRobot = function(ev) { | |
var robot = ev.robot; | |
// robot.fire(4); | |
// robot.rotateCannon(0,1); | |
// robot.fire(1); | |
// robot.rotateCannon(0,1); | |
//robot.rotateCannon(10); | |
// robot.turn(50); | |
//robot.ahead(5000); | |
robot.stop(); | |
robot.fire(); | |
robot.turn(15); | |
robot.ahead(0,5); | |
robot.rotateCannon(-30); | |
robot.fire(); | |
}; | |
Robot.prototype.onRobotCollision = function(ev) { | |
var robot = ev.robot; | |
robot.fire(5); | |
robot.turn(200); | |
robot.ahead(500); // trying to run away | |
robot.clone(robot); | |
}; | |
Robot.prototype.onHitByBullet = function(ev) { | |
var robot; | |
robot = ev.robot; | |
robot.turn(10 - ev.bulletBearing); | |
robot.back(70); | |
robot.ahead(70); | |
}; | |
//Robot.prototype.onScannedRobot = function(ev) { | |
// var robot; | |
// var robot1; | |
//var scanned =ev.scannedRobot; | |
//robot = ev.robot; | |
//robot.fire(5); | |
// robot1.clone(robot); | |
// if(scannedRobot !== robot1.parentId && scanned.parentId !== robot1.id) | |
// robot1.fire(2); | |
//}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment