qq_筱萤火虫_0
2017-01-13 16:40
海葵怎么没动
babyObj.prototype.draw = function () {
// ctx1
this.x = lerpDistance(mum.x, this.x, 0.98);
this.y = lerpDistance(mum.y, this.y, 0.98);
//delta angle
var deltaY = mum.y - this.y;
var deltaX = mum.x - this.x;
var beta = Math.atan2(deltaY,deltaX) + Math.PI;
this.angle = lerpAngle(beta,this.angle,0.6);
ctx1.save();
ctx1.translate(this.x, this.y);
ctx1.rotate(this.angle);
ctx1.drawImage(this.babyTail, -this.babyTail.width*0.5+23, -this.babyTail.height*0.5);
ctx1.drawImage(this.babyBody, -this.babyBody.width*0.5, -this.babyBody.height*0.5);
ctx1.drawImage(this.babyEye, -this.babyEye.width*0.5, -this.babyEye.height*0.5);
ctx1.restore();
}
HTML5小游戏---爱心鱼(上)
92348 学习 · 551 问题
相似问题