我有這個錯誤彈出,當我重新啓動遊戲:錯誤:試圖刪除一個已經被刪除的對象
(錯誤:嘗試刪除包含已經從舞臺或者其母公司中移除的對象/祖先小組已被刪除)
我使用噴氣:removeSelf()函數中因碰撞(下面的代碼)
function explode()
Runtime:removeEventListener("enterFrame", moveJet)
Runtime:removeEventListener("enterFrame", wrap)
jet:removeSelf()
end
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
explode()
end
end
end
Runtime:addEventListener("collision", onCollision)
所以遊戲正常工作的第一次調用,但不是當你重新開始。有關如何解決問題的任何想法?
你在使用故事板嗎? – DevfaR
是的,我正在使用故事板 –