So on the first collision the console print 1 time and on the second colllision the console prints 2 times and so on… how can i fix that?
local function onCollision(event) if event.phase == "began" then if event.target.myName == "Gem" and event.other.myName == "arrow" then local removeTwo = event.other display.remove(removeTwo[hit]) print("hello") end end end arrow[aCounter].collision = onCollision arrow[aCounter]:addEventListener( "collision", arrow[aCounter]) Gem:addEventListener( "collision", onCollision )
Thanks!