Problem with collisions

Hello!

I have a problem with collisions. In LDX i made a level and has placed “stars” which player must to collect.

Main player has been created manually.

There is a part of code of code:

local proj = display.newCircle( 150, 100, 15 ) physics.addBody( proj, { density=1.0, friction=0.3, bounce=0.2 } ) myLevel:addObject('Layer\_1', proj) local function realPlayerCollision(self, event ) local collisionClass = event.other.class print(collisionClass) if (string.len(collisionClass) \> 0 ) then print ('collision ' .. event.phase .. ' with object class',collisionClass,event.other.name) end if ( event.phase == "began" ) then if (collisionClass == 'stars') then myLevel:removeLayerObject("Layer\_1",event.other.name) end end end local function onCollision(self, event ) timer.performWithDelay(1, function() return realPlayerCollision( self, event) end ) end proj.collision = onCollision proj:addEventListener( "collision", proj )

This code I code from example Scroller

But in my game this method does not work. Stars dont dissapear(

Please help me!)

Could you confirm that your collision handler is being fired, so do you see the values of your print statements?

Also, are you sure that the stars reside in the layer called ‘Layer_1’?

Thank you!

I solved that. There is another listener in touch handler. I deleted the last one and it works)

Could you confirm that your collision handler is being fired, so do you see the values of your print statements?

Also, are you sure that the stars reside in the layer called ‘Layer_1’?

Thank you!

I solved that. There is another listener in touch handler. I deleted the last one and it works)