[]物理引擎中更换刚体贴图的方法

this.ball = Matter.Bodies.circle(400, 600,34,
{
//密度
density: 1,
//弹力
restitution:0.4,
container:this.ballBox,
render:
{
sprite:
{
texture: "comp/basketball.png",
xOffset: 34,
yOffset: 34,
}
}
});
我想通过代码随时更改这个刚体上的texture贴图,this.ball.render.sprite.texture="comp/2.png"这个方法只能在游戏刚开始时执行一遍,还有什么其他更换刚体贴图的方法么,那种可以随时更改的那种方法
已邀请:

渔歌

赞同来自:

问题已解决,解决方法:this.ball.layaSprite.loadImage("comp/2.png");
刚体上的贴图只能在刚创建时设置一次,可以用这个方法改变

要回复问题请先

商务合作
商务合作