我正在开发一个简单的“突围”游戏,但在重新加载map
. 例如:如果我从 level1 开始,打破一些砖块并输了,那么我将再次加载同一张地图。下次球与我之前“触摸”过的同一块砖相撞时,会给我一个错误Attempt to remove an object that has already been removed
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
...