Created
December 4, 2012 19:31
-
-
Save pawel-dubiel/4207793 to your computer and use it in GitHub Desktop.
basicus
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) { | |
}; | |
var save_gun_positon = ''; | |
Robot.prototype.onIdle = function(ev) { | |
var robot = ev.robot; | |
for ( i =0; i< 50;i++) { | |
robot.ahead(100); | |
robot.rotateCannon(180); | |
} | |
}; | |
Robot.prototype.onWallCollision = function(ev) { | |
var robot = ev.robot; | |
robot.back(100); | |
}; | |
Robot.prototype.onScannedRobot = function(ev) { | |
var robot = ev.robot; | |
robot.fire(); | |
}; | |
Robot.prototype.onHitByBullet = function(ev) { | |
var robot; | |
robot = ev.robot; | |
robot.turn(90 - ev.bulletBearing); | |
robot.fire(); | |
robot.back(40); | |
robot.ahead(40); | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment