海葵不出来怎么办

来源:2-3 海葵绘制

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回答

  • wanluobo
    2016-07-03 15:59:24
    已采纳

    1 检查下你有没有把这个js引进HTML中

    2 检查下在主函数的init()中是否创建了 ane=new aneObj();

    follow 回复Yao_夫人

    和我一样,drawBackground和aneObj在IE上一直报未定义,虽然还是显示drawBackground未定义,但是背景能显示,加了海葵的方法后,就什么都没有了,我检查了大小写,空格,括号,引用,还是找不到错在哪,现在打算重新写一遍......

    2016-12-29 20:19:01

    共 3 条回复 >

HTML5小游戏---爱心鱼(上)

学做HTML5游戏,轻轻松松带你上手,适合刚入手游戏开发的同学

92353 学习 · 550 问题

查看课程

相似问题

海葵出不来

回答 1

海葵不出来

回答 3

海葵没出来

回答 1

海葵画不出

回答 2

海葵画不出

回答 1