Skip to content

Instantly share code, notes, and snippets.

@maddo
Last active December 27, 2015 12:59
Show Gist options
  • Save maddo/7329831 to your computer and use it in GitHub Desktop.
Save maddo/7329831 to your computer and use it in GitHub Desktop.
scan-bot
ScanBot = BaseRobot;
ScanBot.run = function() {
var robot = this;
robot.shoot();
robot.turn_turret_right(45);
robot.move_forward(Math.random()*400, {
DONE: function() {
robot.shoot();
robot.turn_right(Math.random()*90, {
DONE: function() {
robot.shoot();
robot._run();
}
});
},
ENEMY_COLLIDE: function() {
robot.shoot();
robot.move_backward(100, {
DONE: function() {
robot._run();
},
WALL_COLLIDE: function() {
robot._run();
}
});
},
WALL_COLLIDE: function() {
robot.turn_left(180, {
DONE: function() {
robot.shoot();
robot._run();
}
});
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment