Created
December 7, 2012 17:08
-
-
Save samelinux/4234739 to your computer and use it in GitHub Desktop.
Wall Killer
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
var Robot = function(robot) { | |
robot.rotateCannon(180); | |
}; | |
Robot.prototype.onIdle = function(ev) { | |
ev.robot.back(30); | |
}; | |
Robot.prototype.onScannedRobot = function(ev) { | |
ev.robot.fire(); | |
}; | |
Robot.prototype.onWallCollision = function(ev) { | |
ev.robot.ignore("onRobotCollision"); | |
ev.robot.ignore("onScannedRobot"); | |
ev.robot.turn(ev.bearing - 90); | |
ev.robot.listen("onScannedRobot"); | |
ev.robot.listen("onRobotCollision"); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment