求下移变上浮,已调试多次
好家伙 我这个上浮就跟放风筝一样,只能下移埋地雷
fruitObj.prototype.draw = function(){
for(var i = 0; i < this.num; i++){
if (this.alive[i] == true){
if (this.l[i] < 20){
this.l[i]+=this.speed[i]*0.3*dateTime;
}else{
this.y[i]+=(this.speed[i]*0.4*dateTime);
}
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] )
// 检测,y坐标改变alive状态
if (this.y[i] < 20){
this.alive = false;
}
}
}
}