Created
December 7, 2012 20:06
-
-
Save aquamoogle/4236114 to your computer and use it in GitHub Desktop.
SpecialK 15 Gh3y
This file contains hidden or 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) { }; | |
| var ticks = 0; | |
| Robot.prototype.onIdle = function(ev) { | |
| ev.robot.ahead(1000); | |
| }; | |
| Robot.prototype.onScannedRobot = function(ev) { | |
| var robot = ev.robot; | |
| for(var i = 0; i < 30; i++) | |
| robot.fire(); | |
| }; | |
| Robot.prototype.onRobotCollision = function(ev) { | |
| var robot = ev.robot; | |
| robot.stop(); | |
| robot.back(10); | |
| robot.turn(ev.bearing / 2); | |
| for(var i = 0; i < 30; i++) | |
| robot.fire(); | |
| }; | |
| Robot.prototype.onWallCollision = function(ev) { | |
| var robot = ev.robot; | |
| if(ev.bearing != 0) | |
| robot.turn(ev.bearing); | |
| robot.turn(90); | |
| robot.ahead(1000); | |
| }; | |
| Robot.prototype.onHitByBullet = function(ev) { | |
| //var robot = ev.robot; | |
| //robot.turn(90); | |
| //robot.ahead(1000); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment