I have a function for collision and it works well the first time I enter the scene.
But when I go to some other scene and then back to the one with the collision, the function doesn’t work (the two objects collides but the content of the function isn’t executed.
function onCollision( event )
if ( event.phase == “began” and event.object1.myName == “worker” and event.object2.myName == “boss”) then
worker:removeSelf()
boss:removeSelf()
storyboard.gotoScene( “restart” )
end
end
Any help will be greatly appreciated!