Created
December 7, 2012 12:44
-
-
Save brunoksato/4233030 to your computer and use it in GitHub Desktop.
Fanta Uva
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) { | |
// var robot = ev.robot; | |
} | |
Robot.prototype.onIdle = function(ev) { | |
var robot = ev.robot; | |
robot.clone(); | |
robot.rotateCannon(360); | |
robot.turn(360) | |
// robot.ahead(100); | |
// robot.back(100) | |
}; | |
Robot.prototype.onScannedRobot = function(ev) { | |
var robot = ev.robot; | |
var scanned =ev.scannedRobot; | |
if(scanned.id !== robot.parentId && scanned.parentId !== robot.id) { | |
robot.fire(); | |
robot.rotateCannon(-25); | |
robot.ahead(10); | |
}else{ | |
// robot.back(50); | |
} | |
}; | |
Robot.prototype.onHitByBullet = function(ev) { | |
var robot; | |
robot = ev.robot; | |
robot.turn(90 - ev.bulletBearing); | |
robot.ahead(30); | |
}; | |
Robot.prototype.onWallCollision = function(ev) { | |
var robot = ev.robot; | |
robot.turn(ev.bearing); // turn enought to be in a straight | |
robot.back(100); // angle with the wall. | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment