How to make two images become one?

Hello all,

I want to combine two images into one,

that is, let one image be a background and put the other on the center of first one,

then if I add this group in physic , it can do something like a single object(move or bounce together)

is there any way to do?

thanks

Apply the physics object to the group that contains the two images.

require("physics") physics.start() physics.setGravity(0,0) physics.setDrawMode("normal") --physics.setDrawMode("hybrid") -- this is really useful for debugging local myGroup = display.newGroup() local imageA, imageB = display.newImage( myGroup, "imageA.png" ), display.newImage( myGroup, "imageB.png" ) physics.addBody( myGroup, "dynamic", { friction=.2, bounce=4, density=1 } )

This is only example code, of course, but if you put it in a function and return the myGroup you have the start of useful code. It’s good because you can still apply changes to the images inside the myGroup display group.

thank you horacebury!

that’s useful and easy :slight_smile:

Apply the physics object to the group that contains the two images.

require("physics") physics.start() physics.setGravity(0,0) physics.setDrawMode("normal") --physics.setDrawMode("hybrid") -- this is really useful for debugging local myGroup = display.newGroup() local imageA, imageB = display.newImage( myGroup, "imageA.png" ), display.newImage( myGroup, "imageB.png" ) physics.addBody( myGroup, "dynamic", { friction=.2, bounce=4, density=1 } )

This is only example code, of course, but if you put it in a function and return the myGroup you have the start of useful code. It’s good because you can still apply changes to the images inside the myGroup display group.

thank you horacebury!

that’s useful and easy :slight_smile: