Created
December 5, 2012 02:47
-
-
Save Shipow/4211678 to your computer and use it in GitHub Desktop.
Shipow#001
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) { | |
robot.rotateCannon(-90); | |
}; | |
Robot.prototype.onIdle = function(ev) { | |
var robot = ev.robot; | |
robot.ahead(); | |
//i'll add a clone but i need to refactor collision | |
//robot.clone(); | |
}; | |
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(-15); | |
robot.rotateCannon(15); | |
}else{ | |
} | |
}; | |
Robot.prototype.onHitByBullet = function(ev) { | |
var robot; | |
}; | |
Robot.prototype.onRobotCollision = function(ev) { | |
var robot = ev.robot; | |
robot.rotateCannon(90); | |
}; | |
Robot.prototype.onWallCollision = function(ev) { | |
var robot = ev.robot; | |
robot.turn(-90+ev.bearing); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Wall Robot for the fightcode game.
Simple behavior with "Less is more" philosophy.
Focused on precision and agility.