Hi everyone.
i am using this function to detect collisions between objects, but i am having some problems, because this function dont work, can give me some help?
local ball1 = display.newImage("")
ball1.x = math.round(\_W\*0.5); ball1.y = math.round(\_H\*0.2)
physics.addBody(ball1,"kinematic", { density=2, bounce=0.3,friction=2, radius=25});
local\_group:insert(ball1)
local block = display.newImage("block.png");
block.x = math.round(\_W\*0.25)
block.y = math.round(\_H\*0.98)
block.isVisible = true;
physics.addBody(block, "kinematic", { density=2,friction=2})
block:toFront();
block.myName ="object"
local\_group:insert(block)
function ball1:collision(event)
if event.other.name=="object" then
block:removeSelf()
return true
end
end
ball1:addEventListener("collision",ball1)
Thanks [import]uid: 26056 topic_id: 20796 reply_id: 320796[/import]