combo timing based on frames

This commit is contained in:
garrettdreyfus 2014-05-26 14:07:07 -04:00
parent 911c0faacc
commit 2e15e31fe7
3 changed files with 7 additions and 4 deletions

View file

@ -12,7 +12,8 @@ function Clock(sideLength) {
this.strokeColor = 'blue';
this.x = trueCanvas.width / 2;
this.y = trueCanvas.height / 2;
this.lastCombo = Date.now() - 5000;
this.ct = 0;
this.lastCombo = this.ct - 160;
this.comboMultiplier = 1;
this.texts = [];
@ -126,6 +127,7 @@ function Clock(sideLength) {
};
this.draw = function() {
this.ct++;
this.x = trueCanvas.width/2;
if (gameState == 1) {
this.y = trueCanvas.height/2;

View file

@ -34,5 +34,6 @@ function fadeUpAndOut(text){
}
function fadeOut(text){
text.alive -= 0.02;
text.opacity -= Math.pow(Math.pow((1-text.opacity), 1/3)+1,3)/250;
text.alive = text.opacity;
}

View file

@ -65,8 +65,8 @@ function consolidateBlocks(clock,side,index){
}
}
// add scores
var now = Date.now();
if(now - clock.lastCombo < 5000 ){
var now = MainClock.ct;
if(now - clock.lastCombo < 160 ){
clock.comboMultiplier += 1;
clock.lastCombo = now;
var coords = findCenterOfBlocks(deletedBlocks);