I want my objects to collide and disappear. They’re 2 balls with planet images , coming at eachother and they just pass by over eachother.
Thanx in advance.
require "physics"
physics.start()
local planet = display.newImage("Planet.png")
planet.x = 900
physics.addBody (planet, "static" )
transition.to(planet,{time = 10000, x = -650})
local planet2 = display.newImage("Planet.png")
planet2.x = 5
physics.addBody (planet2, "static")
transition.to(planet2,{time = 10000, x = 900})
local function onLocalCollision( self, event )
if ( event.phase == "began" ) then
event.target:removeSelf()
event.other:removeSelf()
end
end
planet:addEventListener( "collision", planet )
planet2:addEventListener( "collision", planet2 )
[import]uid: 176335 topic_id: 32419 reply_id: 332419[/import]