OK. Here it is. It’s just a setup and not Efficient at this point programming wise but I was just trying to set it up and was going to rework everything once it was running which is probably not a good way to go about it but it works for me.
local composer = require( "composer" ) local scene = composer.newScene() local sndMusic = audio.loadStream("directionsounds.mp3") -- ----------------------------------------------------------------------------------------------------------------- -- All code outside of the listener functions will only be executed ONCE unless "composer.removeScene()" is called. -- ----------------------------------------------------------------------------------------------------------------- -- local forward references should go here -- local forward references should go here local centerX = display.contentCenterX local centerY = display.contentCenterY local screenLeft = display.screenOriginX --screenWidth = display.contentWidth - screenLeft \* 2 local screenWidth = display.contentWidth - screenLeft local screenRight = screenLeft + screenWidth local screenTop = display.screenOriginY --screenHeight = display.contentHeight - screenTop \* 2 local screenHeight = display.contentHeight - screenTop local screenBottom = screenTop + screenHeight local centerX = display.contentCenterX local centerY = display.contentCenterY local \_W = display.contentWidth local \_H = display.contentHeight display.setStatusBar( display.HiddenStatusBar ) -- ------------------------------------------------------------------------------- local dir={} local function playTime() audio.stop() composer.gotoScene ( "valley", { effect="fade", time=200 } ) end local function infoStart() print("made start") transition.to(dir[1],{time=1000, alpha=0 }) transition.to(dir[2],{delay=3000,time=1000, alpha=0 }) dir[3].isHitTestable=true return true end print("curse2") local function goPage3() print("made 3") dir[1]:removeSelf() dir[2]:removeSelf() transition.to(dir[3],{time=1000, alpha=0 }) dir[3].isHitTestable=false dir[4].isHitTestable=true return true end local function goPage4() dir[2]:removeSelf() print("made 4") transition.to(dir[4],{time=1000, alpha=0 }) dir[4].isHitTestable=false dir[5].isHitTestable=true dir[3]:removeEventListener( "tap", goPage3 ) end local function goPage5() print("made 5") transition.to(dir[5],{time=1000, alpha=0 }) dir[5].isHitTestable=false dir[6].isHitTestable=true dir[4]:removeEventListener( "tap", goPage3 ) return true end local function goPage6() print("made 6") transition.to(dir[6],{time=1000, alpha=0 }) dir[6].isHitTestable=false dir[7].isHitTestable=true return true end local function goPage7() print("made 7") transition.to(dir[7],{time=1000, alpha=0 }) transition.to(dir[8],{delay=3000,time=1000, alpha=0 }) transition.to(dir[9],{delay=6000,time=1000, alpha=0 }) dir[7].isHitTestable=false dir[10].isHitTestable=true return true end local function goPage10() print("made 10") transition.to(dir[10],{time=1000, alpha=0 }) dir[10].isHitTestable=false dir[11].isHitTestable=true return true end local function goPage11() print("made 11") transition.to(dir[11],{time=1000, alpha=0 }) transition.to(dir[12],{delay=3000,time=1000, alpha=0 }) dir[11].isHitTestable=false dir[13].isHitTestable=true return true end local function goPage13() print("made 13") transition.to(dir[13],{time=1000, alpha=0 }) transition.to(dir[14],{delay=2000,time=1000, alpha=0 }) transition.to(dir[15],{delay=5000,time=1000, alpha=0 }) dir[13].isHitTestable=false dir[16].isHitTestable=true return true end local function goPage16() print("made 16") transition.to(dir[16],{time=1000, alpha=0 }) dir[16].isHitTestable=false dir[17].isHitTestable=true return true end local function goPage17() print("made 17") transition.to(dir[17],{time=1000, alpha=0 }) dir[17].isHitTestable=false dir[18].isHitTestable=true return true end local function goPage18() print("made 18") transition.to(dir[18],{time=1000, alpha=0 }) dir[18].isHitTestable=false dir[19].isHitTestable=true return true end local function goPage19() print("made 19") transition.to(dir[19],{time=1000, alpha=0 }) transition.to(dir[20],{delay=2000,time=1000, alpha=0 }) dir[19].isHitTestable=false dir[21].isHitTestable=true return true end local function goPage21() print("made 21") print("valley go!") timer.performWithDelay( 1000, playTime ) return true end -- "scene:create()" function scene:create( event ) local sceneGroup = self.view print("the curse") -- Initialize the scene here. -- Example: add display objects to "sceneGroup", add touch listeners, etc. -- Background Image dir[21] = display.newImage("Directionspage21.png") dir[21].width= screenWidth dir[21].height = screenHeight dir[21].isVisible=true dir[21].isHitTestable=true dir[21].x = centerX dir[21].y = centerY sceneGroup:insert(dir[21]) dir[21]:addEventListener("touch",goPage21) dir[20] = display.newImage("Directionspage20.png") dir[20].width= screenWidth dir[20].height = screenHeight dir[20].isVisible=true dir[20].isHitTestable=false dir[20].x = centerX dir[20].y = centerY sceneGroup:insert(dir[20]) dir[19] = display.newImage("Directionspage19.png") dir[19].width= screenWidth dir[19].height = screenHeight dir[19].isVisible=true dir[19].isHitTestable=false dir[19].x = centerX dir[19].y = centerY sceneGroup:insert(dir[19]) dir[19]:addEventListener("tap",goPage19) dir[18] = display.newImage("Directionspage18.png") dir[18].width= screenWidth dir[18].height = screenHeight dir[18].isVisible=true dir[18].isHitTestable=false dir[18].x = centerX dir[18].y = centerY sceneGroup:insert(dir[18]) dir[18]:addEventListener("tap",goPage18) dir[17] = display.newImage("Directionspage17.png") dir[17].width= screenWidth dir[17].height = screenHeight dir[17].isVisible=true dir[17].isHitTestable=false dir[17].x = centerX dir[17].y = centerY sceneGroup:insert(dir[17]) dir[17]:addEventListener("tap",goPage17) dir[16] = display.newImage("Directionspage16.png") dir[16].width= screenWidth dir[16].height = screenHeight dir[16].isVisible=true dir[16].isHitTestable=false dir[16].x = centerX dir[16].y = centerY sceneGroup:insert(dir[16]) dir[16]:addEventListener("tap",goPage16) dir[15] = display.newImage("Directionspage15.png") dir[15].width= screenWidth dir[15].height = screenHeight dir[15].isVisible=true dir[15].isHitTestable=false dir[15].x = centerX dir[15].y = centerY sceneGroup:insert(dir[15]) dir[14] = display.newImage("Directionspage14.png") dir[14].width= screenWidth dir[14].height = screenHeight dir[14].isVisible=true dir[14].isHitTestable=false dir[14].x = centerX dir[14].y = centerY sceneGroup:insert(dir[14]) dir[13] = display.newImage("Directionspage13.png") dir[13].width= screenWidth dir[13].height = screenHeight dir[13].isVisible=true dir[13].isHitTestable=false dir[13].x = centerX dir[13].y = centerY sceneGroup:insert(dir[13]) dir[13]:addEventListener("tap",goPage13) dir[12] = display.newImage("Directionspage12.png") dir[12].width= screenWidth dir[12].height = screenHeight dir[12].isVisible=true dir[12].isHitTestable=false dir[12].x = centerX dir[12].y = centerY sceneGroup:insert(dir[12]) dir[11] = display.newImage("Directionspage11.png") dir[11].width= screenWidth dir[11].height = screenHeight dir[11].isVisible=true dir[11].isHitTestable=false dir[11].x = centerX dir[11].y = centerY sceneGroup:insert(dir[11]) dir[11]:addEventListener("tap",goPage11) dir[10] = display.newImage("Directionspage10.png") dir[10].width= screenWidth dir[10].height = screenHeight dir[10].isVisible=true dir[10].isHitTestable=false dir[10].x = centerX dir[10].y = centerY sceneGroup:insert(dir[10]) dir[10]:addEventListener("tap",goPage10) dir[9] = display.newImage("Directionspage9.png") dir[9].width= screenWidth dir[9].height = screenHeight dir[9].isVisible=true dir[9].isHitTestable=false dir[9].x = centerX dir[9].y = centerY sceneGroup:insert(dir[9]) dir[8] = display.newImage("Directionspage8.png") dir[8].width= screenWidth dir[8].height = screenHeight dir[8].isVisible=true dir[8].isHitTestable=false dir[8].x = centerX dir[8].y = centerY sceneGroup:insert(dir[8]) dir[7] = display.newImage("Directionspage7.png") dir[7].width= screenWidth dir[7].height = screenHeight dir[7].isVisible=true dir[7].isHitTestable=false dir[7].x = centerX dir[7].y = centerY sceneGroup:insert(dir[7]) dir[7]:addEventListener("tap",goPage7) dir[6] = display.newImage("Directionspage6.png") dir[6].width= screenWidth dir[6].height = screenHeight dir[6].isVisible=true dir[6].isHitTestable=false dir[6].x = centerX dir[6].y = centerY sceneGroup:insert(dir[6]) dir[6]:addEventListener("tap",goPage6) dir[5] = display.newImage("Directionspage5.png") dir[5].width= screenWidth dir[5].height = screenHeight dir[5].isVisible=true dir[5].isHitTestable=false dir[5].x = centerX dir[5].y = centerY sceneGroup:insert(dir[5]) dir[5]:addEventListener("tap",goPage5) dir[4] = display.newImage("Directionspage4.png") dir[4].width= screenWidth dir[4].height = screenHeight dir[4].isVisible=true dir[4].isHitTestable=false dir[4].x = centerX dir[4].y = centerY sceneGroup:insert(dir[4]) dir[4]:addEventListener("tap",goPage4) dir[3] = display.newImage("Directionspage3.png") dir[3].width= screenWidth dir[3].height = screenHeight dir[3].isVisible=true dir[3].isHitTestable=false dir[3].x = centerX dir[3].y = centerY sceneGroup:insert(dir[3]) dir[3]:addEventListener("tap",goPage3) dir[2] = display.newImage("Directionspage2.png") dir[2].width= screenWidth dir[2].height = screenHeight dir[2].isVisible=true dir[2].isHitTestable=false dir[2].x = centerX dir[2].y = centerY sceneGroup:insert(dir[2]) dir[1] = display.newImage("Directionspage1.png") dir[1].width= screenWidth dir[1].height = screenHeight dir[1].isVisible=true dir[1].isHitTestable=false dir[1].x = centerX dir[1].y = centerY sceneGroup:insert(dir[1]) print("start info") infoStart() end -- "scene:show()" function scene:show( event ) local sceneGroup = self.view local phase = event.phase if ( phase == "will" ) then -- Called when the scene is still off screen (but is about to come on screen). elseif ( phase == "did" ) then -- Called when the scene is now on screen. -- Insert code here to make the scene come alive. -- Example: start timers, begin animation, play audio, etc. local backgroundMusic = audio.play(sndMusic, {channel=2, loops=-1}) end end -- "scene:hide()" function scene:hide( event ) local sceneGroup = self.view local phase = event.phase if ( phase == "will" ) then -- Called when the scene is on screen (but is about to go off screen). -- Insert code here to "pause" the scene. -- Example: stop timers, stop animation, stop audio, etc. audio.stop() elseif ( phase == "did" ) then -- Called immediately after scene goes off screen. end end -- "scene:destroy()" function scene:destroy( event ) local sceneGroup = self.view -- Called prior to the removal of scene's view ("sceneGroup"). -- Insert code here to clean up the scene. -- Example: remove display objects, save state, etc. composer.removeScene("curse") end -- ------------------------------------------------------------------------------- -- Listener setup scene:addEventListener( "create", scene ) scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene ) scene:addEventListener( "destroy", scene ) -- ------------------------------------------------------------------------------- return scene
I wasn’t done writing everything when I came upon this problem so the code is unfinished at the moment. For instance I was just starting to remove objects and event listeners when this problem arose. Thanks for your help.