added combo multiplier

This commit is contained in:
garrettdreyfus 2014-05-25 23:12:47 -04:00
parent ff2978b9ad
commit 7b6a910865
2 changed files with 12 additions and 1 deletions

View file

@ -12,6 +12,8 @@ function Clock(sideLength) {
this.strokeColor = 'blue'; this.strokeColor = 'blue';
this.x = trueCanvas.width / 2; this.x = trueCanvas.width / 2;
this.y = trueCanvas.height / 2; this.y = trueCanvas.height / 2;
this.lastCombo;
this.comboMultiplier = 1;
for (var i = 0; i < this.sides; i++) { for (var i = 0; i < this.sides; i++) {
this.blocks.push([]); this.blocks.push([]);

View file

@ -63,6 +63,15 @@ function consolidateBlocks(clock,side,index){
} }
} }
// add scores // add scores
score += deleting.length*deleting.length; var now = Date.now();
if(now - clock.lastCombo < 5000 ){
clock.comboMultiplier += 1;
clock.lastCombo = now;
}
else{
clock.lastCombo = now;
clock.comboMultiplier = 1;
}
score += deleting.length * deleting.length * clock.comboMultiplier;
} }