Carson_成
2015-11-09 18:07
//这是我的代码块 var fruitObj = function() { this.alive = [];//boolen this.x = []; this.y = []; this.l = []; this.orange = new Image(); this.blue = new Image(); }; fruitObj.prototype.num = 30; fruitObj.prototype.init = function () { for (var i = 0; i < this.num; i++) { this.alive[i]=true; this.x[i]=0; this.y[i]=0; this.l[i] = 0; this.bron(i); } this.orange.src = "./src/fruit.png"; this.blue.src = "./src/blue.png"; }; fruitObj.prototype.draw = function() { for (var i = 0; i < this.num; i++) { console.log(deltaTime);//可打印出deltaTime数值 if (this.l[i]<=15) { console.log(deltaTime);//打印出NaN this.l[i]+=0.01 *deltaTime; //console.log(this.l[i]);//同样NaN } ctx2.drawImage(this.orange,this.x[i] - this.l[i] * 0.5,this.y[i]-this.l[i] * 0.5,this.l[i],this.l[i]); } }; fruitObj.prototype.update = function() { var num = 0; for (var i = 0; i < this.num; i++) { if (this.alive[i]) { num++; } } }; fruitObj.prototype.bron = function(i) { var aneID = Math.floor(Math.random()*ane.num); this.x[i] = ane.x[aneID]; this.y[i] = canHeight- ane.len[aneID]; };
+1不行啊
你们都解决了吗?我的也是如此!检查了好几遍都不行,急求答案!!!
同问,我的也显示不出来
同问,不知楼主是否已经解决此问题
运行了你的代码,都可以打印出来数值,Chrome浏览器
同问,不知楼主是否已经解决此问题
HTML5小游戏---爱心鱼(上)
92348 学习 · 551 问题
相似问题