In my menu for my game I am using a moving background, and a physics body just to make it move. I am using the same code as was provided by corona for the menu and level1. When it switches to level1, the physics bodies are still there and are interacting with the physics bodies I have in the actual scene, and the entire menu scene is behind my level1. Is there anything I am not doing that I need to add in? here is the code minus the objects and pictures Im using.
[lua]
local storyboard = require( “storyboard” )
local scene = storyboard.newScene()
– include Corona’s “widget” library
local widget = require “widget”
– forward declarations and other locals
local playBtn
– ‘onRelease’ event listener for playBtn
local function onPlayBtnRelease()
– go to level1.lua scene
storyboard.gotoScene( “level1”, “fade”, 500 )
return true – indicates successful touch
end
– BEGINNING OF YOUR IMPLEMENTATION
–
– NOTE: Code outside of listener functions (below) will only be executed once,
– unless storyboard.removeScene() is called.
–
– Called when the scene’s view does not exist:
function scene:createScene( event )
local group = self.view
– create a widget button (which will loads level1.lua on release)
playBtn = widget.newButton{
--label=“Play Now”,
--labelColor = { default={255}, over={128} },
default=“playbutton1.png”,
over=“playbutton2.png”,
width=231, height=60,
onRelease = onPlayBtnRelease – event listener function
}
playBtn:setReferencePoint( display.CenterReferencePoint )
playBtn.x = display.contentWidth*0.5
playBtn.y = display.contentHeight - 545
playBtn.xScale = 2.5
playBtn.yScale = 2.5
– all display objects must be inserted into group
group:insert( background )
group:insert( titleLogo )
group:insert( playBtn )
group:insert( face)
group:insert( background2 )
group:insert( background3 )
group:insert( background4 )
group:insert( floor )
group:insert( floor2 )
end
– Called immediately after scene has moved onscreen:
function scene:enterScene( event )
local group = self.view
– INSERT code here (e.g. start timers, load audio, start listeners, etc.)
end
– Called when scene is about to move offscreen:
function scene:exitScene( event )
local group = self.view
– INSERT code here (e.g. stop timers, remove listenets, unload sounds, etc.)
end
– If scene’s view is removed, scene:destroyScene() will be called just prior to:
function scene:destroyScene( event )
local group = self.view
if playBtn then
playBtn:removeSelf() – widgets must be manually removed
playBtn = nil
end
end
– END OF YOUR IMPLEMENTATION
– “createScene” event is dispatched if scene’s view does not exist
scene:addEventListener( “createScene”, scene )
– “enterScene” event is dispatched whenever scene transition has finished
scene:addEventListener( “enterScene”, scene )
– “exitScene” event is dispatched whenever 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 )
return scene
[/lua]