I see that storyboard is being replace with composer but I am creating this project for a class I am taking and storyboard is required. I start with main.lua, then start.lua (which has a play button to run through 4 seasons), spring.lua, summer.lua, autumn.lua, then winter.lua. That works fine, but I want to either go back to start so user can replay or to spring to repeat. I have changed the call in winter to go to main.lua , tried spring.lua, tried start;lua - all ends when spring.lua loads. I tap the screen and instead of moving to summer.lua like the first time through it stops. Below is the code from main.lua, start.lua, sping.lua, and winter.lua. (summer.lua and autumn.lua are the same as the others with different backgrounds.) I am new at this and cannot see my problem. Could someone point out my error please? Thank you in advance.
-- main.lua local storyboard = require "storyboard" -- Load the first scene to be shown storyboard.gotoScene( "start")
--------------------------------------------------------------------------------- -- -- start.lua -- --------------------------------------------------------------------------------- local storyboard = require "storyboard" local scene = storyboard.newScene() --------------------------------------------------------------------------------- -- BEGINNING OF YOUR SCENE --------------------------------------------------------------------------------- --Called if the scene hasn't been previously seen function scene:createScene( event ) local StartGroup = self.view imgSeasons = display.newImage("seasons.png", 0, 0) imgSeasons.x = display.contentWidth / 2 imgSeasons.y = display.contentHeight / 2 StartGroup:insert(imgSeasons) imgPlay = display.newImage("lilac\_play.png") imgPlay.x = display.contentWidth / 2 imgPlay.y = display.contentHeight / 2 + 200 StartGroup:insert(imgPlay) end function onBackgroundTouch() storyboard.gotoScene("spring", "fade", 400) end function scene:enterScene(event) imgPlay:addEventListener("touch", onBackgroundTouch) end function scene:exitScene(event) imgPlay:removeEventListener("touch", onBackgroundTouch) end function scene:destroyScene(event) end scene:addEventListener( "createScene", scene ) scene:addEventListener( "enterScene", scene ) scene:addEventListener( "exitScene", scene ) scene:addEventListener( "destroyScene", scene ) return scene
--------------------------------------------------------------------------------- -- -- spring.lua -- --------------------------------------------------------------------------------- local storyboard = require "storyboard" local scene = storyboard.newScene() --------------------------------------------------------------------------------- -- BEGINNING OF YOUR SCENE --------------------------------------------------------------------------------- --Called if the scene hasn't been previously seen function scene:createScene( event ) local SpringGroup = self.view backgroundImage = display.newImage("spring.png", 0, 0) backgroundImage.x = display.contentWidth/2 backgroundImage.y = display.contentHeight/2 SpringGroup:insert(backgroundImage) springText = display.newText("Spring",0 ,0, nil, 36) springText.x = display.contentWidth/2 springText.y = display.contentHeight/2 SpringGroup:insert(springText) end local function onBackgroundTouch() storyboard.gotoScene( "summer", {effect = "zoomInOut", time = 800 } ) end function scene:enterScene(event) backgroundImage:addEventListener("touch", onBackgroundTouch) end function scene:exitScene(event) backgroundImage:removeEventListener("touch", onBackgroundTouch) end function scene:destroyScene(event) end scene:addEventListener( "createScene", scene ) scene:addEventListener( "enterScene", scene ) scene:addEventListener( "exitScene", scene ) scene:addEventListener( "destroyScene", scene ) return scene
--------------------------------------------------------------------------------- -- -- winter.lua -- --------------------------------------------------------------------------------- local storyboard = require "storyboard" local scene = storyboard.newScene() --------------------------------------------------------------------------------- -- BEGINNING OF YOUR SCENE --------------------------------------------------------------------------------- --Called if the scene hasn't been previously seen function scene:createScene( event ) local WinterGroup = self.view backgroundImage = display.newImage("winter.png", 0, 0) backgroundImage.x = display.contentWidth/2 backgroundImage.y = display.contentHeight/2 WinterGroup:insert(backgroundImage) winterText = display.newText("Winter",0 ,0, nil, 36) winterText.x = display.contentWidth/2 winterText.y = display.contentHeight/2 WinterGroup:insert(winterText) end local function onBackgroundTouch() storyboard.gotoScene( "spring", {effect = "zoomInOut", time = 800 } ) end function scene:enterScene(event) backgroundImage:addEventListener("touch", onBackgroundTouch) end function scene:exitScene(event) backgroundImage:removeEventListener("touch", onBackgroundTouch) end function scene:destroyScene(event) end scene:addEventListener( "createScene", scene ) scene:addEventListener( "enterScene", scene ) scene:addEventListener( "exitScene", scene ) scene:addEventListener( "destroyScene", scene ) return scene
That’s a lot of code to post, sorry, I would appreciate the help.