fruitObj.prototype.draw=function () {
for(var i=0;i<this.num;i++){
// draw
// find a ane,grow,fly up
if(this.l[i]<=14){
this.l[i]+=0.01*daltaTime;
}
else{
this.y[i]-=0.07*daltaTime
}
ctx2.drawImage(this.orange,this.x[i]-this.l[i]*0.5, this.y[i]-this.l[i]*0.5,this.l[i],this.l[i])
}
}
//果实状态,允许15个
fruitObj.prototype.update=function () {
var num=0;
for(var i=0;i<num;i++){
if(this.alive[i]){
num++
}
}
}
fruitObj.prototype.born=function (i) {
// 找到坐标
// 问题:不用取整,无法获得ID
var aneId=Math.floor(Math.random()*ane.num);
this.x[i]=ane.x[aneId];
this.y[i]=canHeight-ane.y[aneId]
this.l[i]=0;
}