diff --git a/js/Text.js b/js/Text.js index f4700ad..ddc726a 100644 --- a/js/Text.js +++ b/js/Text.js @@ -5,9 +5,10 @@ function Text(x,y,text,font,color,incrementFunction){ this.color = color; this.opacity =1; this.text = text; + this.alive=1; this.draw = function(){ - if(this.opacity>0){ + if(this.alive>0){ ctx.font= this.font; ctx.fillStyle = this.color; ctx.globalAlpha = this.opacity; @@ -28,9 +29,10 @@ function Text(x,y,text,font,color,incrementFunction){ function fadeUpAndOut(text){ text.opacity -=0.07; + text.alive = text.opacity; text.y-=3; } function fadeOut(text){ - text.opacity -= 0.02; + text.alive -= 0.02; } diff --git a/js/checking.js b/js/checking.js index 288da6b..7fe63a6 100644 --- a/js/checking.js +++ b/js/checking.js @@ -70,7 +70,7 @@ function consolidateBlocks(clock,side,index){ clock.comboMultiplier += 1; clock.lastCombo = now; var coords = findCenterOfBlocks(deletedBlocks); - clock.texts.push(new Text(coords['x'],coords['y'],"x "+clock.comboMultiplier.toString(),"bold Lovelo 24px",deletedBlocks[0].color,fadeOut)); + clock.texts.push(new Text(coords['x'],coords['y'],"x "+clock.comboMultiplier.toString(),"bold Lovelo 24px","#fff",fadeOut)); } else{ clock.lastCombo = now;