fixed block detection
This commit is contained in:
parent
f6d208917e
commit
cbba963675
1 changed files with 25 additions and 0 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue