大鱼不显示出来,请大神帮忙支招

来源:2-7 大鱼绘制

罗罗诺亚_索罗

2018-10-31 10:14

var momObj = function() //大鱼
{	
this.x;	
this.y;
this.bigEye = new Image();	
this.bigBody = new Image();	
this.bigTail = new Image();
}
momObj.prototype.init = function()
{	
this.x = canWidth * 0.5;	
this.y = canHeight * 0.5;	
this.bigEye.src = "img/bigEye0.png";	
this.bigBody.src = "img/bigSwim0.png";	
this.bigTail.src = "img/bigTail0.png";
}
momObj.prototype.draw = function()
{	
ctx1.save();	
ctx1.translate(this.x,this.y);	
ctx1.drawImage(this.bigEye, -this.bigEye.width*0.5, -this.bigEye.height*0.5);
ctx1.drawImage(this.bigBody, -this.bigBody.width*0.5, -this.bigBody.height*0.5);	
ctx1.drawImage(this.bigTail, -this.bigTail.width*0.5 + 30, -this.bigTail.height*0.5); 
ctx1.restore();
}


写回答 关注

2回答

  • 一颗理性的脑袋
    2019-01-09 12:03:13

    mian里的执行顺序的问题正确的是

    drawBackground();
    fruitMonitor();
    fruit.draw();
    mom.draw();



  • 慕粉4323859
    2018-12-26 18:37:04

    我粘贴复制了,这串代码没有问题。你看看<script type="text/javascript" src="js/mom.js"></script>写没有,或者mom.draw();

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

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

92353 学习 · 550 问题

查看课程

相似问题