added combo multiplier
This commit is contained in:
parent
ff2978b9ad
commit
7b6a910865
2 changed files with 12 additions and 1 deletions
|
@ -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([]);
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue