Wrap around the conductor

parent c6a16b37
......@@ -3,7 +3,7 @@ defmodule Grains.Mixfile do
def project do
[app: :grains,
version: "0.0.77",
version: "0.0.78",
elixir: "~> 1.2",
elixirc_paths: elixirc_paths(Mix.env),
compilers: [:phoenix, :gettext] ++ Mix.compilers,
......
......@@ -111,10 +111,16 @@ Boid.prototype.render = function() {
// Wraparound
Boid.prototype.borders = function() {
if (this.position.x < this.radius) this.velocity.x = -this.velocity.x;
if (this.position.y < this.radius) this.velocity.y = -this.velocity.y;
if (this.position.x > PresenceSketch.width - this.radius) this.velocity.x = -this.velocity.x;
if (this.position.y > PresenceSketch.height - this.radius) this.velocity.y = -this.velocity.y;
if (this.position.x < -this.radius) this.position.x = width +this.radius;
if (this.position.y < -this.radius) this.position.y = height+this.radius;
if (this.position.x > width +this.radius) this.position.x = -this.radius;
if (this.position.y > height+this.radius) this.position.y = -this.radius;
// if (this.position.x < this.radius) this.velocity.x = -this.velocity.x;
// if (this.position.y < this.radius) this.velocity.y = -this.velocity.y;
// if (this.position.x > PresenceSketch.width - this.radius) this.velocity.x = -this.velocity.x;
// if (this.position.y > PresenceSketch.height - this.radius) this.velocity.y = -this.velocity.y;
};
// Separation
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment