I have my code set to change scene when reaching a certain number of points. For now, it’s set to change back to the main menu, just until I get the proper scene sorted. However, when the user clicks play (after the scene change back to the main menu) All the objects are still there (stationary, so the physics stopped) and yet the code for spawning in the objects still runs. On top of this, the new objects that spawn in, don’t collide with the walls that are set there. Here’s my exitScene:
function scene:exitScene( event ) local group = self.view local flygroup = self.view physics.stop() if (listenertimer) then timer.cancel(listenertimer) listenertimer = nil end if (spawntimer) then timer.cancel(spawntimer) spawntimer = nil end if (flygroup) then for i=1,numFlies do display.remove(flygroup) flygroup = nil print("group removed") end end if (scorefield) then scorefield:removeSelf() scorefield = nil end if (spawnedflies) then spawnedflies = 0 end if (flying) then for i=1,numFlies do flying:removeSelf() flying = nil end end if (splat) then splat:removeSelf() splat = nil end end
I’m thinking I need to purge the data from the original scene completely, but I’m unsure how to do that.