I’m attempting a basic scene change. I’ve modified the Castle Demo and inserted it into a scene called “world”, based on Storyboard demo. Within the “world” scene, I have a listener that calls a scene change to one called “battle”. The “battle” scene seems to load (the debug says so at least) but I can’t seem to get the map to display. I should also note that before my “battle” scene loads, my sprites disappear and the original map, “world”, is still displayed. I am doing a mte.cleanup() in my destroyscene() method as well…
Any advise appreciated
From “world”
local function handleAction(event) if event.phase == "ended" or event.phase == "cancelled" then -- displayWords(cde.myText) storyboard.gotoScene("battle", {effect = "fade", time = 1000}) end end
From “battle”
-- includes and etc above function scene:willEnterScene(event) local group = self.view --LOAD MAP ------------------------------------------------------------ mte.toggleWorldWrapX(true) mte.toggleWorldWrapY(true) mte.loadTileSet("dungeon3DMap", "tilesets/dungeon3DMap.png") mte.loadTileSet("innerFlat", "tilesets/innerFlat.png") mte.loadTileSet("castle3DMap", "tilesets/castle3DMap.png") mte.loadTileSet("townFlat", "tilesets/townFlat.png") mte.loadMap("map/battle.json") -- mte.goto({ locX = 10, locY = 10, blockScaleX = 64, blockScaleY = 64}) --CREATE PLAYER SPRITE ---------------- -- -- Don't think I need all this if it's already setup in world in myData / cde. -- local setup = { kind = "sprite", layer = mte.getSpriteLayer(1), locX = 10, locY = 10, levelWidth = 32, levelHeight = 32, solid = true } mte.addSprite(cde.player, setup) local locX, locY locX, locY = 34, 33 mte.goto({ locX = locX, locY = locY, blockScaleX = 32, blockScaleY = 32}) group:insert(mte.getMapObj()) -- This should at least display the map? mte.update() end local function gameLoop( event ) mte.debug() mte.update() end -- Called immediately after scene has moved onscreen: function scene:enterScene( event ) Runtime:addEventListener("enterFrame", gameLoop) end --------------------------------------------------------------------------------- -- END OF YOUR IMPLEMENTATION --------------------------------------------------------------------------------- -- "willEnterScene" event is dispatched before scene transition begins scene:addEventListener( "willEnterScene", scene ) -- "enterScene" event is dispatched whenever scene transition has finished scene:addEventListener( "enterScene", scene ) -- "exitScene" event is dispatched before next scene's transition begins scene:addEventListener( "exitScene", scene ) -- "destroyScene" event is dispatched before view is unloaded, which can be -- automatically unloaded in low memory situations, or explicitly via a call to -- storyboard.purgeScene() or storyboard.removeScene(). scene:addEventListener( "destroyScene", scene )