blocks being generated no checking happening
This commit is contained in:
parent
9116411bb9
commit
e1979053b5
5 changed files with 12 additions and 11 deletions
|
@ -12,11 +12,14 @@ function floodFill(clock,side,index,deleting) {
|
|||
for(var x =-1;x<2;x++){
|
||||
for(var y =-1;y<2;y++){
|
||||
if(Math.abs(x)==Math.abs(y)){continue;}
|
||||
if(clock.blocks[(side+x+clock.sides)%clock.sides] === undefined){continue;}
|
||||
if(clock.blocks[(side+x+clock.sides)%clock.sides][index+y] !== undefined){
|
||||
if(clock.blocks[(side+x+clock.sides)%clock.sides][index+y].color == color && search(deleting,[(side+x+clock.sides)%clock.sides,index+y]) === false) {
|
||||
deleting.push([(side+x+clock.sides)%clock.sides,index+y]);
|
||||
floodFill(clock,(side+x+clock.sides)%clock.sides,index+y,deleting);
|
||||
console.log("hey");
|
||||
var curSide =(side+x+clock.sides)%clock.sides;
|
||||
var curIndex = curIndex;
|
||||
if(clock.blocks[curSide] === undefined){continue;}
|
||||
if(clock.blocks[curSide][curIndex] !== undefined){
|
||||
if(clock.blocks[curSide][curIndex].color == color && search(deleting,[curSide,curIndex]) === false) {
|
||||
deleting.push([curSide,curIndex]);
|
||||
floodFill(clock,curSide,curIndex,deleting);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ function Block(lane, color, iter, distFromHex, settled) {
|
|||
this.removed = 0;
|
||||
this.tint = 0; //todo
|
||||
this.opacity = 1;
|
||||
this.initializing = 1;
|
||||
this.initialization = 1;
|
||||
this.parentArr;
|
||||
this.iter = iter;
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ keypress.register_combo({
|
|||
if (Math.abs(gameState) == 1) {
|
||||
gameState = -gameState;
|
||||
}
|
||||
requestAnimFrame(animLoop);
|
||||
requestAnimFrame(animloop);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -144,8 +144,7 @@ function update() {
|
|||
var objectsToRemove = [];
|
||||
for (i in blocks) {
|
||||
MainClock.doesBlockCollide(blocks[i]);
|
||||
if (!blocks[i].settled && !blocks[i].initializing) {
|
||||
debugger;
|
||||
if (!blocks[i].settled) {
|
||||
blocks[i].distFromHex -= blocks[i].iter;
|
||||
} else if(!blocks[i].removed){
|
||||
blocks[i].removed = 1;
|
||||
|
@ -187,7 +186,6 @@ function render() {
|
|||
}
|
||||
|
||||
for (i in blocks) {
|
||||
debugger;
|
||||
blocks[i].draw();
|
||||
}
|
||||
|
||||
|
|
|
@ -152,4 +152,4 @@ function generatorFunction() {
|
|||
|
||||
// In each generator function you need a few things
|
||||
// Something defining when the next block is being generated
|
||||
// Something defining which and when the next function is going to be passed
|
||||
// Something defining which and when the next function is going to be passed
|
||||
|
|
Loading…
Reference in a new issue