0

私はこのonCollision関数を持っていますが、ゲームが最初から衝突するたびに2倍になります

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 )

これが起こる理由はありますか?

4

2 に答える 2