From cbba963675c8644bf069c552a66864c406e99095 Mon Sep 17 00:00:00 2001 From: meadowstream Date: Sat, 24 May 2014 15:48:48 -0400 Subject: [PATCH] fixed block detection --- js/entities.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/js/entities.js b/js/entities.js index 62a1173..a336a2b 100644 --- a/js/entities.js +++ b/js/entities.js @@ -25,6 +25,31 @@ function Block(lane, color, iter, distFromHex, settled) { this.distFromHex = 300; } + this.incrementOpacity = function() { + if (this.deleted) { + var lane = MainClock.sides - this.lane;// -this.position; + lane += MainClock.position; + + lane = (lane+MainClock.sides) % MainClock.sides; + + this.opacity = this.opacity - 0.1; + if (this.opacity <= 0) { + this.opacity = 0; + var i = 0; + var j = this.getIndex(); + this.parentArr.splice(j,1); + if (j < this.parentArr.length) { + for (i = j; i < this.parentArr.length; i++) { + this.parentArr[i].settled = 0; + } + } + } + } + if(!this.deleted && this.opacity < 1){ + this.opacity = this.opacity + 0.05; + } + }; + this.getIndex = function (){ for (var i = 0; i < this.parentArr.length; i++) { if (this.parentArr[i] == this) {