Working on managing the transition between a menu, a level, and then back to the level. In my game.lua file which runs the levels I load a bunch of different modules (player.lua, gem.lua, and floor.lua) which control various aspects of the level. I made it so that when the escape key is pressed composer.gotoScene(“menu”); is called. However, all of the modules are still loaded in the menu. I can tell because if the player stays in one spot for 5s or more they die and ~5s after the menu is opened I see my debug error message come up “player is dead!” which is called from floor.lua. So how do I manage scenes properly so that when I go to another scene all of the other modules are deactivated? My whole previous scene including physics, etc. still runs behind the menu but with no display.
Thanks in advance for any help