Created
December 6, 2012 15:52
-
-
Save cymruu/4225531 to your computer and use it in GitHub Desktop.
strims
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
function Robot(robot) {} | |
// well, we need to do something... | |
// whenever our robot is idle, this method gets called. | |
Robot.prototype.onIdle = function(ev) { | |
var robot; | |
robot = ev.robot; | |
robot.ahead(150); | |
robot.rotateCannon(360); | |
robot.back(100); | |
robot.rotateCannon(360); | |
robot.turn(90); | |
}; | |
// this method gets called whenever we hit another robot... | |
Robot.prototype.onRobotCollision = function(ev) {}; | |
// this method gets called whenever we hit a wall... | |
Robot.prototype.onWallCollision = function(ev) {}; | |
// yay we see another robot! time to wreak some havoc... | |
Robot.prototype.onScannedRobot = function(ev) { | |
var robot; | |
robot = ev.robot; | |
robot.fire(1); | |
}; | |
Robot.prototype.onHitByBullet = function(ev) { | |
var robot; | |
robot = ev.robot; | |
robot.turn(90 - ev.bulletBearing); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment