deluan
12/8/2012 - 3:42 PM

Bubu

Bubu


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.
};