Ok so basically me and my friend are creating a game with collisions. we are having a problem where once the collision is done, the game crashes. if someone could look at this code its really not all that much it would mean alot and if you could possibly come up with a solution that would be even better. here are all the collision code we have
function onCollision(event)
–print(“collide!”)
happy:removeSelf()
end
Runtime:addEventListener(“collision”, onCollision)
local function onCollision( self, event )
if ( event.phase == “began” ) then
– Check if body still exists before removing
if( happy) then
happy:removeSelf()
happy = nil
end
end
end