floating adder color of scored

This commit is contained in:
garrettdreyfus 2014-05-26 12:45:52 -04:00
parent d53768bf48
commit 5abb300163
2 changed files with 9 additions and 5 deletions

View file

@ -11,7 +11,7 @@ function Text(x,y,text,font,color,incrementFunction){
ctx.font= this.font;
ctx.fillStyle = this.color;
ctx.globalAlpha = this.opacity;
ctx.fillText(text,this.x,this.y);
ctx.fillText(text,this.x+gdx,this.y+gdy);
ctx.globalAlpha =1;
//this.opacity = 1-(Date.now()-MainClock.lastCombo)/5000;
incrementFunction(this);
@ -27,6 +27,10 @@ function Text(x,y,text,font,color,incrementFunction){
}
function fadeUpAndOut(text){
text.opacity -=0.05;
text.opacity -=0.07;
text.y-=3;
}
function fadeOut(text){
text.opacity -= 0.01 ;
}

View file

@ -43,6 +43,7 @@ function consolidateBlocks(clock,side,index){
//record which sides have been changed
var sidesChanged =[];
var deleting=[];
var deletedBlocks = []
//add start case
deleting.push([side,index]);
//fill deleting
@ -60,9 +61,9 @@ function consolidateBlocks(clock,side,index){
}
//mark as deleted
clock.blocks[arr[0]][arr[1]].deleted = 1;
deletedBlocks.push(clock.blocks[arr[0]][arr[1]]);
}
}
var lastBlock = clock.blocks[arr[0]][arr[1]]
// add scores
var now = Date.now();
if(now - clock.lastCombo < 5000 ){
@ -74,7 +75,6 @@ function consolidateBlocks(clock,side,index){
clock.comboMultiplier = 1;
}
var adder = deleting.length * deleting.length * clock.comboMultiplier;
clock.texts.push(new Text(clock.x,clock.y,"+ "+adder.toString(),"bold Roboto 24px","#9b59b6",fadeUpAndOut));
clock.texts.push(new Text(clock.x,clock.y,"+ "+adder.toString(),"bold Roboto 24px",deletedBlocks[0].color,fadeUpAndOut));
score += adder;
}