慕粉185119458
2017-02-28 20:24
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 = "./src/bigEye0.png"; this.bigBody.src = "./src/bigSwim0.png"; this.bigTail.src = "./src/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(); }
把main.js中这句代码注释掉看看:ctx1.clearRect(0, 0, canWidth, canHeight)
this.bigEye.Height => this.bigEye.height,小写的height
我的大鱼也没有出来,但是没有提示错误,你最后如何解决的呢?
我也是出现了和你相同的错误 你最后是怎么解决的?
f12看看有没有错误,如果没有错误,看看main.js中有没有调用大鱼的draw方法。
HTML5小游戏---爱心鱼(上)
92350 学习 · 551 问题
相似问题