猿问

求求大家了我明天要交这个可是突然不能显示鱼了

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);/*方法转换画布的用户坐标系统。平移,将画布的坐标原点向左右方向移动x,向上下方向移动y.canvas的默认位置是在(0,0)*/

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();

}


慕粉4249962
浏览 1227回答 1
1回答

wDan_9527

draw ()方法只定义了,没执行
随时随地看视频慕课网APP

相关分类

Html5
我要回答