Skip to content

Instantly share code, notes, and snippets.

@ikkebr
Forked from samelinux/robot.js
Created December 12, 2012 17:05
Show Gist options
  • Save ikkebr/4269596 to your computer and use it in GitHub Desktop.
Save ikkebr/4269596 to your computer and use it in GitHub Desktop.
Multiple Wall Killer
var Robot = function(robot) {
robot.clone();
};
Robot.prototype.onIdle = function(ev) {
ev.robot.back(30);
robot.rotateCannon(180);
};
Robot.prototype.onScannedRobot = function(ev) {
if(!ev.robot.parentId) 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