I’ve been reading just about every single thread similar to my question and can’t find a solution to my problem.
I understand that when a SceneGroup is removed, all objects in it are removed as well.
This works!
However, when calling composer.gotoScene(“menu”), I am still seeing all of the physics bodies of the objects from “level1” while in “hybrid” mode.
Would you be able to help me figure out how to get rid of these?
The image is being removed, however the display body remains
Here is a snippet of my code.
[lua]
–this is in scene create
sceneGroup:insert( background )
sceneGroup:insert( grass)
sceneGroup:insert( boat )
sceneGroup:insert(scoreText)
function scene:hide( event )
local sceneGroup = self.view
local phase = event.phase
if event.phase == “will” then
spawnController(“stop”, spawnParams)
physics.stop()
elseif phase == “did” then
end
end
function scene:destroy( event )
Runtime:removeEventListener(“touch”, moveBoat)
Runtime:removeEventListener(“collision”, onCollision)
for id, value in pairs(timer._runlist) do
timer.cancel(value)
end
display.remove(lifeRing)
display.remove(lifeRing2)
display.remove(lifeRing3)
display.remove(score)
scoreText = nil
package.loaded[physics] = nil
physics = nil
local sceneGroup = self.view
display.remove(sceneGroup)
–boat:removeSelf()
–grass:removeSelf()
end
[/lua]