MY ROBOTS

ABSOLUTELY EVERYTHING ABOUT YOUR ARMY OF ROBOTS
  • # 287
    Wall-e
    created 08/16/15 47 code lines fight fork
    1545 SCORE
    33 KILLS
    954 SHOTS
    304 HITS
    31.83%
    AVERAGE HITS/SHOT
    SCORE OVER TIME
    //FightCode can only understand your robot //if its class is called Robot var Robot = function(r) { }; Robot.prototype.onIdle = function(ev) { var r = ev.robot; r.clone(); r.rotateCannon(360); r.ahead(150); r.turn(30); r.ahead(150); }; Robot.prototype.onScannedRobot = function(ev) { var r = ev.robot; if (ev.scannedRobot.parentId == r.id || ev.scannedRobot.id == r.parentId) { return; }; var ax = ev.scannedRobot.position.x; var ay = ev.scannedRobot.position.y; var myx = r.position.x; var myy = r.position.y; var dist = Math.sqrt(Math.pow((myx-ax), 2)+ Math.pow((myy-ay),2)); r.rotateCannon(5); r.fire(); r.turn(10); r.rotateCannon(-30); r.ahead(15); }; Robot.prototype.onHitByBullet = function(ev) { var r = ev.robot; r.disappear(); }; Robot.prototype.onWallCollision = function(ev) { var r = ev.robot; r.back(50); }; Robot.prototype.onRobotCollision = function(ev) { var r = ev.robot; r.back(30); };