I’ve been messing around with this for 8+ hours and have had no luck. How do I remove an object with physics once it touches another and also add score every time it does so. I’ve tried the “physics.removeBody()” api, Collision Detection api and have been following Peach Pellen’s Score board tutorial but haven’t been able to adapt anything.
Anything, even if you just point me would be much appreciated:)
Here’s the code I’ve been using for object removal:
[code]
local function onCollision( event )
if ( event.phase == “began” ) then
– Check if body still exists before removing!
if ( spawnObject ) then
spawnObject:removeSelf()
spawnObject = nil
end
end
end
Runtime:addEventListener(“collision”, onCollision)
[import]uid: 66317 topic_id: 19113 reply_id: 319113[/import]
[import]uid: 52491 topic_id: 19113 reply_id: 73687[/import]