qq_一头会飞的翔_03623174
2017-05-08 21:00
ctx1.translate(this.x,this.y);
ctx1.rotate(this.angle+60);
ctx1.drawImage(babyTail[this.babyTailCount],-babyTail[this.babyTailCount].width * 0.5 + 25,-babyTail[this.babyTailCount].height * 0.5);
ctx1.drawImage(this.babyBody,-this.babyBody.width * 0.5,-this.babyBody.height * 0.5);
ctx1.drawImage(this.babyEye,-this.babyEye.width * 0.5,-this.babyEye.height * 0.5);
ctx1.restore();
提示我这段代码有问题:Uncaught DOMException: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The HTMLImageElement provided is in the 'broken' state.
应该是读不到正确的图片,你检查一下图片的路径是否正确,另外,在写 ctx1.drawImage(babyTail[this.babyTailCount],-babyTail[this.babyTailCount].width * 0.5 + 25,-babyTail[this.babyTailCount].height * 0.5);之前还要写var babyTailCount = this.babyTailCount;
HTML5小游戏---爱心鱼(下)
46272 学习 · 189 问题
相似问题