Skip to content

Instantly share code, notes, and snippets.

Created September 29, 2015 03:38

Revisions

  1. @invalid-email-address Anonymous created this gist Sep 29, 2015.
    19 changes: 19 additions & 0 deletions ant.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    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;

    }