I got a weird bug with the Corona SDK related to collision detection and lib.
Here is my listener onCollision:
local function onBottomBorderCollision( event )
if (event.other.isBall) then
local index = table.indexOf( ballArray, other )
table.remove( ballArray, index )
event.other:removeSelf( )
event.other = nil
updateLife(false)
updateScore(false)
end
end
This works well on the first start, but after returning to the menu screen (using storyboard.goToScene("menu"))and re-playing the game, now this listener will raise the following error every time one of my balls gets to the bottom border:
attempt to index other field (nil value)
I create the correct listeners in scene:onEnterScene(scene), so it is not associated with them, moreover, this other listener never generates an error:
local function onPlayerCollision( event )
if(event.other.isBall) then
xVel, yVel = event.other:getLinearVelocity( )
event.other:setLinearVelocity( event.other.XLinearVelocity, yVel )
end
end
I'm stuck right now ... please help!