Skip to content

Instantly share code, notes, and snippets.

Created September 29, 2015 03:38
Show Gist options
  • Save anonymous/5802bf10784e2e5f9eab to your computer and use it in GitHub Desktop.
Save anonymous/5802bf10784e2e5f9eab to your computer and use it in GitHub Desktop.
An ant script saved from https://github.com/jywarren/antfarm
onRun = function() {
this.direction += Math.random()*10-5;
if (this.green() > 0) {
this.energy += this.green();
this.green(0);
}
if (this.energy <= 0) this.die();
this.color = "rgba("+this.energy+",0,0,1)";
this.energy -= 1;
this.trail('green', 255); // color, amount
}
onBump = function() {
this.direction += 90;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment