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-07-03 23:07:51 +00:00
|
|
|
if (this.alive>0) {
|
2014-05-26 15:22:52 +00:00
|
|
|
ctx.globalAlpha = this.opacity;
|
2014-07-04 13:46:14 +00:00
|
|
|
renderText((this.x + gdx), (this.y + gdy),40,this.color,this.text);
|
2014-05-26 15:22:52 +00:00
|
|
|
ctx.globalAlpha =1;
|
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-06-24 02:26:00 +00:00
|
|
|
};
|
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-07-03 21:51:13 +00:00
|
|
|
}
|