为什么不把眼睛眨动的图片在baby对象里面初始化呢,这样main是不是显得更清晰?
babyObj.prototype.init = function () {
this.x = canWidth * 0.5;
this.y = canHeight * 0.5 ;
//this.babyEye.src = "src/babyEye0.png";
this.babyBody.src = "src/babyFade0.png";
this.angle = 0;
this.babyTailCount = 0;
this.babyTailTimer = 0;
for (var i = 0; i < 8; i++) {
this.babyTail[i] = new Image();
this.babyTail[i].src = "src/babyTail" + i + ".png";
}
this.babyEyeCount = 0;
this.babyEyeTimer = 0;
for (var i = 0; i < 2; i++) {
this.babyEye[i] = new Image();
this.babyEye[i].src = "src/babyEye" + i + ".png";
}