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]
The issue with the nil function has been fixed for the next version, it was meant to be fixed for 3.2 but somehow got missed. To fix it just open up “lime-tile.lua” and change:
visual:removeSelf()
to
if visual and visual["removeSelf"] then
visual:removeSelf()
end
It may be worth looking into the map:reload() function as it may do what you want. [import]uid: 5833 topic_id: 9430 reply_id: 34555[/import]
for example:
transition.to(background,{time=2000,alpha=0}) or
transition.to(background.group,{time=2000,alpha=0})
currently I doing this manually using a lot of functions,background.group.alpha and timer.performWithDelay [import]uid: 14085 topic_id: 9430 reply_id: 34556[/import]