Hi. I have a game where the player collects coins. I have an event listener which detects collisions for these coins. I’m using director, and I remove the event listener in my clean function, but when you re-enter the game scene to play again, two collisions are being detected. I think that my event listener is not being properly removed, but I am not getting any errors.
Here are the relevant parts of my code
local function onCollision(event) --Collision code... All of this works and is correct.. end Runtime:addEventListener("collision", onCollision) function clean ( event ) Runtime:removeEventListener("collision", onCollision) print("cleaned") end
Thanks in advance