I’ve been thinking of using the following method to switch between maps:
currentMap = 1
function loadMap()
map = lime.loadMap(“map”…currentMap…".tmx")
end
if collectables == 10 then
map:destroy()
currentMap = (currentMap + 1)
loadMap()
end
…
map:destroy() gives me an error:
Runtime error
/Users/MerelFaber/Desktop/platform/lime-tile.lua:795: attempt to call method ‘removeSelf’ (a nil value)
which is the function Tile:destroy():
local visual = self:getVisual()
if visual then
visual:removeSelf()
visual = nil
end
Once I remove the destroy line it does load the new map… it just shows both the previous and the newest map. Using :hide() on the previous map isn’t an option either, because the collision areas are still there.
any input on how to properly remove the map or any alternative for this system (I was hoping to avoid using director)?
[import]uid: 14085 topic_id: 9430 reply_id: 309430[/import]