change image of colliding and moving body

Hi, I understand the basics of adding a body and physics to an image i.e.

local crate = display.newImage( “crate.png” )
crate.x = 180; crate.y = -50;
physics.addBody( crate, { density=3.0, friction=0.5, bounce=0.3 } )

but what if I wanted to change crate.png to crate2.png upon collision? or even crate3.png or crate4.png depending on different variables - (i.e. collision force, collision object)… I get the collision detection bit, its swapping images that I’m stuck on, especially if I want the image to still be moving and rotating with the physics body.

Thanks,

Matthew [import]uid: 13568 topic_id: 7409 reply_id: 307409[/import]

Make the crate a movieclip or sprite instead of a single image. Then add a collision listener to advance to the frame containing the new image. If you’re unfamiliar with sprites, go the movieclip route. [import]uid: 41305 topic_id: 7409 reply_id: 26195[/import]