weixin_慕勒4259824
2016-07-03 15:38
330fish.js:52 Uncaught TypeError: Cannot read property 'draw' of undefined
aneobj.prototype.draw = function(){
for(var i=0;i<this.num;i++){
ctx2.beginPath();
ctx2.moveTo(this.x[i],cHeight);
ctx2.lineTo(this.x[i],cHeight - this.len[i]);
ctx2.lineWidth = 20;
ctx2.linCap = "round";
ctx2.strokeStyle ="purple";
ctx2.stroke();
}function gameloop(){
requestAnimFrame(gameloop);
var now = Date.now();
deltaTime = now - lastTime;
lastTime = now;
drawBackground();
ane.draw();
}
1 检查下你有没有把这个js引进HTML中
2 检查下在主函数的init()中是否创建了 ane=new aneObj();
HTML5小游戏---爱心鱼(上)
92341 学习 · 583 问题
相似问题