this.x[i] = ane.x[aneID];這句話報Uncaught ReferenceError: i is not defined這個錯誤怎么解決??求大神解答
fruit.js中this.x[i] = ane.x[aneID];這句話報Uncaught ReferenceError: i is not defined這個錯誤怎么解決??求大神解答
fruit.js中this.x[i] = ane.x[aneID];這句話報Uncaught ReferenceError: i is not defined這個錯誤怎么解決??求大神解答
2016-01-12
舉報
2016-01-13
看看對象名寫對沒,是fruitObj,這是我的代碼
fruitObj.prototype.born=function(i)
{
var aneID=Math.floor(Math.random()*ane.num);
? ? this.x[i]=ane.x[aneID];
? ? this.y[i]=canHeight-ane.len[aneID];
? ? this.l[i]=0;
? ? this.alive[i]=true;
? ? var ran=Math.random();
? ? if(ran<0.2)
? ? {
? ? ? this.fruitType[i]="blue";//orange,blue
? ? }
? ? else{
? ? ? this.fruitType[i]="orange";
? ? }
? ??
?}