fixed block detection

This commit is contained in:
meadowstream 2014-05-24 15:48:48 -04:00
parent f6d208917e
commit cbba963675

View file

@ -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) {