Removing Scene effecting the number of MTE levels?

Hello-

I’m making a game in which one basic tiled map is re-used for the entire game but the scene has to reset to a default state before each turn. I am using the suggested Composer layout to transition between game states with a removeScene(“scene”) to kill the previous turn and gotoScene(“scene”) to start again. For some reason I am only able to run the game twice before seeing a blank screen. In my console window, I see this:

Jan  1 20:50:48 MacBook.local Corona Simulator[30615]: World Size X: 1000

Jan  1 20:50:48 MacBook.local Corona Simulator[30615]: World Size Y: 30

Jan  1 20:50:48 MacBook.local Corona Simulator[30615]: Levels: 1

Jan  1 20:50:48 MacBook.local Corona Simulator[30615]: Reference Layer: 1

Jan  1 20:50:48 MacBook.local Corona Simulator[30615]: WARNING(detectSpriteLayers): No Sprite Layers Found. Defaulting to all map layers.

Jan  1 20:50:48 MacBook.local Corona Simulator[30615]: Map Load Time(ms): 182.5

Jan  1 20:50:55 MacBook.local Corona Simulator[30615]: BALL VELOCITY IS ZERO

Jan  1 20:51:00 — last message repeated 136 times —

Jan  1 20:51:00 MacBook.local Corona Simulator[30615]: you are pressing the button to try again

Jan  1 20:51:00 MacBook.local Corona Simulator[30615]: World Size X: 1000

Jan  1 20:51:00 MacBook.local Corona Simulator[30615]: World Size Y: 30

Jan  1 20:51:00 MacBook.local Corona Simulator[30615]: Levels: 2

Jan  1 20:51:00 MacBook.local Corona Simulator[30615]: Reference Layer: 1

Jan  1 20:51:00 MacBook.local Corona Simulator[30615]: Map Load Time(ms): 3.0579999999991

Jan  1 20:51:09 MacBook.local Corona Simulator[30615]: BALL VELOCITY IS ZERO

The bolded sections are what confuse me. Why do the levels change to 2 on the 2nd loading of the same map and why does the map not detect a sprite layer only on the first throw? This makes me think the error is related to the tiled map itself even though it DOES contain an object/sprite layer and a tiled layer…

Another interesting thing is that when mte.debug() is running, the FPS for the first throw will be ~30 but for the second throw, above 1000. This makes me think that the prior map/debug session isn’t being removed from the prior turn. I do use mte.cleanup() in the scene:destroy() function. 

Any suggestions?

Not much to go on without code…but first I would like to direct you to “Changing scenes cause ‘masterGroup’ to be a nil?” thread in the MTE forums, this guy had the same problem with changing scenes and I gave tips there to solve it. Also your fps jumping from 30-1000 could be somehow you are clicking on the button to enter the scene 2nd time and it double clicks it which will cause some crazy effects just like that, should have a check so he can only press the button once even if user tries to smash the key down.

Thanks for the reply and the suggestion. I figured out my problem I believe: I was using my composer.removeScene(“scene”) in the composer:create function instead of the composer:show function. I now get a reliable reset of the scene like I am looking for. The FPS problem still exists but I imagine this is because the mte.debug() is not loaded into the sceneGroup like all other on-screen objects so it is not removed correctly like the rest of the scene. 

What is being loaded in my output above is a tiled map that is 1000x30 so I am not too concerned about that. 

Not much to go on without code…but first I would like to direct you to “Changing scenes cause ‘masterGroup’ to be a nil?” thread in the MTE forums, this guy had the same problem with changing scenes and I gave tips there to solve it. Also your fps jumping from 30-1000 could be somehow you are clicking on the button to enter the scene 2nd time and it double clicks it which will cause some crazy effects just like that, should have a check so he can only press the button once even if user tries to smash the key down.

Thanks for the reply and the suggestion. I figured out my problem I believe: I was using my composer.removeScene(“scene”) in the composer:create function instead of the composer:show function. I now get a reliable reset of the scene like I am looking for. The FPS problem still exists but I imagine this is because the mte.debug() is not loaded into the sceneGroup like all other on-screen objects so it is not removed correctly like the rest of the scene. 

What is being loaded in my output above is a tiled map that is 1000x30 so I am not too concerned about that.