鸟速度不匀速的方法Math.sqrt(this.i++); 开根号

function Bird(imgArr, x, y){
this.imgArr = imgArr;
this.x = x;
this.y = y;
this.idx = parseInt(Math.random() * this.imgArr.length);
this.img = this.imgArr[this.idx];
// 定义一个变量用于记录鸟的位置
this.positionY = 0;
// 定义一个变量用于改变鸟的位置
this.i = 0;
}

 

Bird.prototype.fall = function(){
  this.positionY += Math.sqrt(this.i++);
};

posted @ 2018-01-20 11:31  ︶ㄣ鳯躌氷瀚  阅读(132)  评论(0编辑  收藏  举报