我正在製作一個簡單的「breakout」遊戲,並且我有重新加載map
的問題。例如:如果我從level1開始,打破一些磚塊並丟失,比我再次加載相同的地圖。接下來的那個球與同磚我「感動」碰撞時間之前,都會給我一個錯誤Attempt to remove an object that has already been removed
Corona「嘗試移除已被移除的物體」
local map = lime.loadMap("maps/" .. currentLevel .. ".tmx")
local layer = map:getTileLayer("bricks_1")
local visual = lime.createVisual(map)
local physical = lime.buildPhysical(map)
function removeBricks(event)
if event.other.isBrick then
local brick = event.other
transition.to(brick, {time = 20, alpha = 0})
score = score + brick.scoreValue
ScoreNum.text = score
-- remove brick
brick:removeSelf()
brick = nil
...
請寫你的錯誤代碼行。 – vovahost