问答详情
源自:2-4 果实绘制(静态果实)

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];
 

}


提问者:greenhandc 2015-12-21 15:15

个回答

  • qq_圈里圈不出圈里圈_0
    2016-01-21 14:01:15

    第四行blue写成了bliue,draw后面for中的i<this.num 写错了,写成 name了