I have this onCollision function but every time the game starts over the collision double up
local function onCollision(event) if event.phase == "began" and gameIsActive == true then local obj1 = event.object1; local obj2 = event.object2; if obj1.name == "jetplayer" and obj2.name == "BCloud1" then MinLife() elseif obj1.name == "jetplayer" and obj2.name == "BCloud2" then pontsMin10() elseif obj1.name == "jetplayer" and obj2.name == "BCloud3" then pontsMin20() elseif obj1.name == "jetplayer" and obj2.name == "GCloud1" then pontsplus50() elseif obj1.name == "jetplayer" and obj2.name == "bla" then score = score - 20 end end end Runtime:addEventListener( "collision", onCollision ) function scene:exitScene( event ) Runtime:removeEventListener( "collision", onCollision )
is there any reason for this to happen ?