Yes here is the heavily edited version of my code in main.lua (I put it all at the end) You will note I had to duplicate some code twice since the first time we go to scene, we instead go to enterScene and then subsequently go to createScene.
local image
local imageOnce = false
local storyGroup
local function onSceneTouch( self, event )
if event.phase == “began” then
storyboard.gotoScene( false, “scene1”, “zoomOutInFadeRotate”, 1000 )
return true
end
end
– Called when the scene’s view does not exist:
function scene:createScene( event )
storyGroup = self.view
image = display.newImage( “Title-screen.jpg” )
storyGroup:insert( image )
image.touch = onSceneTouch
end
– Called immediately after scene has moved onscreen:
function scene:enterScene( event )
if imageOnce == false then
– following code should be in createScene
storyGroup = self.view
image = display.newImage( “Title-screen.jpg” )
storyGroup:insert( image )
image.touch = onSceneTouch
imageOnce = true
end
image:addEventListener( “touch”, image )
storyboard.purgeScene( “scene1” )
end
– Called when scene is about to move offscreen:
function scene:exitScene()
image:removeEventListener( “touch”, image )
display.remove( image )
end
– Called prior to the removal of scene’s “view” (display group)
function scene:destroyScene( event )
end
scene:addEventListener( “createScene”, scene )
scene:addEventListener( “enterScene”, scene )
scene:addEventListener( “exitScene”, scene )
scene:addEventListener( “destroyScene”, scene )
– Called when the scene’s view does not exist:
function scene1:createScene( event )
storyGroup = self.view
setup( Level, storyGroup )
Runtime:addEventListener( “enterFrame”, StartofGameLoop )
end
– Called immediately after scene has moved onscreen:
function scene1:enterScene( event )
storyboard.purgeScene( “scene” )
end
– Called when scene is about to move offscreen:
function scene1:exitScene()
removeGraphics( Level )
end
scene1:addEventListener( “createScene”, scene1 )
scene1:addEventListener( “enterScene”, scene1 )
scene1:addEventListener( “exitScene”, scene1 )
[import]uid: 108253 topic_id: 19806 reply_id: 77405[/import]