差太多
2016-10-18 12:02
var dustObj =function ()
{
this.x = [];
this.y = [];
this.amp = [];
this.dustNo = [];
this.alpha;
}
dustObj.prototype.num = 30;
dustObj.prototype.init =function ()
{
for (var i=0;i<this.num;i++)
{
this.x[i] = Math.random() * canWidth;
this.x[i] = Math.random() * canHeight;
this.amp[i] = 20 + Math.random() * 30;
this.dustNo[i] = Math.floor(Math.random() * 7 );
}
this.alpha = 0;
}
dustObj.prototype.draw = function()
{
this.alpha += deltaTime * 0.0007;
var len = Math.sin(this.alpha);
for (var i=0;i<this.num;i++)
{
var no = this.dustNo[i];
cxt1.drawImage(dustPic[no], this.x[i] + this.amp[i] * len, this.y[i]);
}
}
找到了 有个地方this,y写成了this.x
HTML5小游戏---爱心鱼(下)
46272 学习 · 189 问题
相似问题