My character collides with an object that is a sensor. When he collides with the sensor object he picks it up and adds it to the image of the character. I therefor need to swap the character images which is all fine and dandy it’s just corona will refuse to allow me to add a physics body.
I have tried:
• adding the body with a delay ( tried different delays even 500 didnt work)
• using if event.phase “ended” (or whatever it is that still didnt work)
• I tried calling the function directly
I cant think of any more ideas.
Please can someone help me? here is the code:
if event.object1.name == "obj1" or event.object2.name == "obj1" then object1:removeSelf( ) local skaterY = skater.y skater:removeSelf( ) skater = nil skater = display.newImage("skater1.png") skater.x = 230 skater.y = skaterY skater.xScale = 0.3 skater.yScale = 0.3 skater.name = "james" skater.isFixedRotation = true end if event.phase == "ended" then timer.performWithDelay( 10, addSkaterPhys() ) end end
thank you