TTweet = enchant.Class.create(enchant.Sprite, {
- initialize : function(w, h) {
+ initialize : function(yukkuri, w, h) {
+ this.x = 0;
+ this.y = 0;
+ this.yukkuri = yukkuri;
this.lifetime = 0;
enchant.Sprite.call(this, w, h + TTweet.TAIL);
this.image = new Surface(w, h + TTweet.TAIL);
ld : {x: 0+s, y:h+t-s}
};
this.image.context.font = "12px 'Times New Roman'";
+ var self = this;
this.addEventListener('enterframe', function(){
if((this.age % 15) == 0){
this.lifetime--;
this.lifetime = 0;
this.opacity = 0;
}
+ this.x = self.yukkuri.getX() - self.width/4 - self.yukkuri.getWidth() / 2;
+ this.y = self.yukkuri.getY() - self.height - self.yukkuri.getHeight() / 2;
+ // this._tweet.text(text, this.getX() - this._tweet.width/4, this.getY() - this._tweet.height);
});
},
reDraw : function() {
};
},
text : function(text, x, y) {
+ this.x = this.yukkuri.getX() - this.width/4 - this.yukkuri.getWidth() / 2;
+ this.y = this.yukkuri.getY() - this.height - this.yukkuri.getHeight() / 2;
+ x = this.x;
+ y = this.y;
this.clear();
this.opacity = 0.8;
this.reDraw();
with(this.image.context) {
- // var size = measureText(text);
fillStyle = 'black';
textAlign = 'center';
textBaseline = 'middle';
this.x = x;
this.y = y;
- // fillText(text,this.width/2,this.height/2);
- // console.log(size);
- // this.width = size;
- // console.log(this.width);
- // this.reDraw();
var textList = text.split("\n");
var len = textList.length / 2;
var height = (this.height/(1 + len));
scene.addChild(this);
}
});
+App.YUtil = enchant.Class.create(enchant.Sprite,{
+ randomLooks : function(){
+ return rand(_.size(ELooks));
+ }
+});
//how to use