开发者

Corona sdk swap image files

Is there a simple way to swap an image that is assigned to a body? Example code:

local cat = display.newImage( "catright.png",100, 375 ); 
physics.addBody( cat, { density=0.9, friction=5, bounce=0 } );

cat.name = "cat";

At ce开发者_高级运维rtain times, I need to swap catright.png for catleft.png.

Thanks for any advice.


I am not sure, but you can use a single .png file to use as a sprite sheet instead. Then you can add two sequences named as "catright" and "catleft", and use them in necessary places.

This link is a good reference point:

http://developer.anscamobile.com/reference/sprite-sheets

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜