I’m working on a simple “breakout” game and I have problem reloading a map.
for example: if I start with level1, break some bricks and lose, than I’m loading the same map again. next time that the ball collides with the same brick I “touched” before, will give me an error 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 ...