2014-05-26 16:27:30 +00:00
|
|
|
function Text(x,y,text,font,color,incrementFunction){
|
2014-05-26 15:22:52 +00:00
|
|
|
this.x = x;
|
|
|
|
this.y = y;
|
|
|
|
this.font = font;
|
|
|
|
this.color = color;
|
|
|
|
this.opacity =1;
|
|
|
|
this.text = text;
|
2014-05-26 17:18:27 +00:00
|
|
|
this.alive=1;
|
2014-05-26 15:22:52 +00:00
|
|
|
|
|
|
|
this.draw = function(){
|
2014-05-26 17:18:27 +00:00
|
|
|
if(this.alive>0){
|
2014-06-22 04:26:46 +00:00
|
|
|
ctx.save();
|
|
|
|
var sf = settings.scale;
|
|
|
|
ctx.scale(sf, sf);
|
2014-05-26 15:22:52 +00:00
|
|
|
ctx.font= this.font;
|
|
|
|
ctx.fillStyle = this.color;
|
|
|
|
ctx.globalAlpha = this.opacity;
|
2014-06-22 04:26:46 +00:00
|
|
|
ctx.fillText(this.text,(this.x + gdx) * (1/sf), (this.y + gdy) * (1/sf));
|
2014-05-26 15:22:52 +00:00
|
|
|
ctx.globalAlpha =1;
|
2014-06-22 04:26:46 +00:00
|
|
|
ctx.restore();
|
2014-05-26 16:27:30 +00:00
|
|
|
incrementFunction(this);
|
|
|
|
return true;
|
|
|
|
}
|
2014-05-31 14:55:36 +00:00
|
|
|
else {
|
2014-05-26 16:27:30 +00:00
|
|
|
return false;
|
2014-05-26 15:22:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2014-05-26 16:27:30 +00:00
|
|
|
|
|
|
|
function fadeUpAndOut(text){
|
2014-05-26 18:14:30 +00:00
|
|
|
text.opacity -= Math.pow(Math.pow((1-text.opacity), 1/3)+1,3)/100;
|
2014-05-26 17:18:27 +00:00
|
|
|
text.alive = text.opacity;
|
2014-05-26 16:27:30 +00:00
|
|
|
text.y-=3;
|
|
|
|
}
|
2014-05-26 16:45:52 +00:00
|
|
|
|