fruit出不来啊,
Uncaught SyntaxError: Unexpected token ILLEGAL
这个说是for(var i=0;i<this.num;i++)错了
代码
var fruitObject=function(){
this.alive=[];//boolean
this.orange=new Image();
this.bliue=new Image();
this.x=[];
this.y=[];
}
fruitObject.prototype.num=30;
fruitObject.prototype.init=function() {
for(var i=0;i<this.num;i++){
this.alive[i]=true;
this.x[i]=0;
this.y[i]=0;
this.born(i);
}
this.orange.src="./src/fruit.png";
this.blue.src="./src/blue.png";
}
fruitObject.prototype.draw=function(){
for(var i=0;i<this.name;i++){
ctx2.drawImage(this.orange,this.x[i],this.y[i]);
}
}
fruitObject.prototype.born=function(i){
var aneid=Math.floor(Math.random()*ane.num);
this.x[i]=ane.x[aneid];
this.y[i]=canHeight-ane.length[aneid];
}