Level Navigation

local storyboard = require( "storyboard" )  
local scene = storyboard.newScene()  
  
-- this will only happen once when the scene is first required.   
 print ("in load splashscreen file")  
  
function scene:createScene( event )  
 local group = self.view  
   
 display.setStatusBar(display.HiddenStatusBar)   
 print ("in load splashscreen file")  
  
   
 --BACKGROUND IMAGES   
  
 local background = display.newImage("gnomiessplashbg.png")  
 group:insert(background) -- must be in the scene's view ("group") to be managed.  
 background.x = display.contentWidth / 2  
 background.y = display.contentHeight / 2   
  
 --media.playSound( "gnomiesmusic.mp3", true )   
  
 local backgroundbg2 = display.newImage("gnomiessplashbg2.png")  
 group:insert(backgroundbg2)  
 backgroundbg2.x = display.contentWidth / 2  
 backgroundbg2.y = display.contentHeight / 2   
 --BACKGROUND IMAGES END   
  
 --BUTTONS  
   
 local worlds = display.newImage("gnomiesPlaybutton.png" )  
 group:insert(worlds)  
  
 worlds.x = display.contentWidth / 1.9  
 worlds.y = display.contentHeight / 2.1   
   
 --END BUTTONS   
   
 local function touched (event)  
 if ("ended" == event.phase) then  
 storyboard:gotoScene( "worlds", "fade" )   
 end   
 end  
   
 worlds:addEventListener ("touch", touched)  
end  
  
function scene:enterScene( event )  
 local group = self.view  
   
end  
   
function scene:exitScene( event )  
 local group = self.view  
   
end  
   
function scene:destroyScene( event )  
 local group = self.view  
   
end  
scene:addEventListener( "createScene", scene )  
scene:addEventListener( "enterScene", scene )  
scene:addEventListener( "exitScene", scene )  
scene:addEventListener( "destroyScene", scene )  
   
return scene  

changeScene() is a director method. storyboard uses gotoScene() [import]uid: 199310 topic_id: 34149 reply_id: 136934[/import]

Awesome!, thanks for clearing that up for me. 1 last thing. If I wanted to make multiple buttons how would I do that? I tried to just copy and change what I thought was needed but that appears to not be the case.

My fail attempt:

 local function playtouched (event)  
 if ("ended" == event.phase) then  
 storyboard:gotoScene( "worlds", "fade" )   
 end   
 end  
   
 worlds:addEventListener ("touch", playtouched)  
end  
  
 local function optionstouched (event)  
 if ("ended" == event.phase) then  
 storyboard:gotoScene( "options", "fade" )   
 end   
 end  
   
 options:addEventListener ("touch", optionstouched)  
end  
  
 local function abouttouched (event)  
 if ("ended" == event.phase) then  
 storyboard:gotoScene( "about", "fade" )   
 end   
 end  
   
 about:addEventListener ("touch", abouttouched)  
end  

I’m assuming the way I’m creating local function after local function is not the right way.
[import]uid: 72845 topic_id: 34149 reply_id: 136946[/import]

Can you post the full code. There are a bunch of ends that don’t need to be there. I don’t see where you are creating the buttons to attach the handlers too.

[import]uid: 199310 topic_id: 34149 reply_id: 136948[/import]

My appologies

[code]
local storyboard = require( “storyboard” )
local scene = storyboard.newScene()

– this will only happen once when the scene is first required.
print (“in load splashscreen file”)

function scene:createScene( event )
local group = self.view

display.setStatusBar(display.HiddenStatusBar)
print (“in load splashscreen file”)

–BACKGROUND IMAGES

local background = display.newImage(“gnomiessplashbg.png”)
group:insert(background) – must be in the scene’s view (“group”) to be managed.
background.x = display.contentWidth / 2
background.y = display.contentHeight / 2

–media.playSound( “gnomiesmusic.mp3”, true )

local backgroundbg2 = display.newImage(“gnomiessplashbg2.png”)
group:insert(backgroundbg2)
backgroundbg2.x = display.contentWidth / 2
backgroundbg2.y = display.contentHeight / 2
–BACKGROUND IMAGES END

–BUTTONS

local worlds = display.newImage(“gnomiesPlaybutton.png” )
group:insert(worlds)

worlds.x = display.contentWidth / 1.9
worlds.y = display.contentHeight / 2.1

local optionsbutton = display.newImage(“gnomiesOptionsbutton.png” )
group:insert(optionsbutton)

optionsbutton.x = display.stageWidth / 1.9
optionsbutton.y = display.stageHeight / 1.5

local aboutbutton = display.newImage(“gnomiesAboutbutton.png” )
group:insert(aboutbutton)

aboutbutton.x = display.stageWidth / 1.9
aboutbutton.y = display.stageHeight / 1.16

–END BUTTONS

local function playtouched (event)
if (“ended” == event.phase) then
storyboard:gotoScene( “worlds”, “fade” )
end
end

worlds:addEventListener (“touch”, playtouched)
end

local function optionstouched (event)
if (“ended” == event.phase) then
storyboard:gotoScene( “options”, “fade” )
end
end

options:addEventListener (“touch”, optionstouched)
end

local function abouttouched (event)
if (“ended” == event.phase) then
storyboard:gotoScene( “about”, “fade” )
end
end

about:addEventListener (“touch”, abouttouched)
end

function scene:enterScene( event )
local group = self.view

end

function scene:exitScene( event )
local group = self.view

end

function scene:destroyScene( event )
local group = self.view

end
scene:addEventListener( “createScene”, scene )
scene:addEventListener( “enterScene”, scene )
scene:addEventListener( “exitScene”, scene )
scene:addEventListener( “destroyScene”, scene )

return scene
[/code] [import]uid: 72845 topic_id: 34149 reply_id: 136952[/import]

You are pretty close. Keep in mind that in lua, chunks as they are know (blocks of code) have to have a matching end for each start. If you have a “function”, there is a matching “end”. If you have an “if” there is a matching end. You have a few extra “ends” in your code:

[code]
local storyboard = require( “storyboard” )
local scene = storyboard.newScene()

– this will only happen once when the scene is first required.
print (“in load splashscreen file”)

function scene:createScene( event )
local group = self.view

display.setStatusBar(display.HiddenStatusBar)
print (“in load splashscreen file”)

–BACKGROUND IMAGES

local background = display.newImage(“gnomiessplashbg.png”)
group:insert(background) – must be in the scene’s view (“group”) to be managed.
background.x = display.contentWidth / 2
background.y = display.contentHeight / 2

–media.playSound( “gnomiesmusic.mp3”, true )

local backgroundbg2 = display.newImage(“gnomiessplashbg2.png”)
group:insert(backgroundbg2)
backgroundbg2.x = display.contentWidth / 2
backgroundbg2.y = display.contentHeight / 2
–BACKGROUND IMAGES END

–BUTTONS

local worlds = display.newImage(“gnomiesPlaybutton.png” )
group:insert(worlds)

worlds.x = display.contentWidth / 1.9
worlds.y = display.contentHeight / 2.1

local optionsbutton = display.newImage(“gnomiesOptionsbutton.png” )
group:insert(optionsbutton)

optionsbutton.x = display.stageWidth / 1.9
optionsbutton.y = display.stageHeight / 1.5

local aboutbutton = display.newImage(“gnomiesAboutbutton.png” )
group:insert(aboutbutton)

aboutbutton.x = display.stageWidth / 1.9
aboutbutton.y = display.stageHeight / 1.16

–END BUTTONS

local function playtouched (event)
if (“ended” == event.phase) then
storyboard:gotoScene( “worlds”, “fade” )
end
end

worlds:addEventListener (“touch”, playtouched)
– end –
local function optionstouched (event)
if (“ended” == event.phase) then
storyboard:gotoScene( “options”, “fade” )
end
end

options:addEventListener (“touch”, optionstouched)
– end –
local function abouttouched (event)
if (“ended” == event.phase) then
storyboard:gotoScene( “about”, “fade” )
end
end

about:addEventListener (“touch”, abouttouched)
end

function scene:enterScene( event )
local group = self.view

end

function scene:exitScene( event )
local group = self.view

end

function scene:destroyScene( event )
local group = self.view

end
scene:addEventListener( “createScene”, scene )
scene:addEventListener( “enterScene”, scene )
scene:addEventListener( “exitScene”, scene )
scene:addEventListener( “destroyScene”, scene )

return scene
[/code] [import]uid: 199310 topic_id: 34149 reply_id: 136957[/import]

Alright now that that’s cleared up. For some reason it’s still not working : (

my splashscreen.lua is exactly as the one you posted and my options.lua is

local storyboard = require( "storyboard" )  
local scene = storyboard.newScene()  
   
-- this will only happen once when the scene is first required.   
 print ("in load splashscreen file")  
   
function scene:createScene( event )  
 local group = self.view  
   
 display.setStatusBar(display.HiddenStatusBar)   
 print ("in load splashscreen file")  
  
   
 --BACKGROUND IMAGES   
  
 local background = display.newImage("gnomiessplashbg.png")  
 group:insert(background) -- must be in the scene's view ("group") to be managed.  
 background.x = display.contentWidth / 2  
 background.y = display.contentHeight / 2   

I just did something minimal to see if it would work.

Here’s what the terminal is telling me:

error loading module ‘options’ from file ‘/Users/focuslab/Desktop/Level Select Beta/options.lua’:
/Users/focuslab/Desktop/Level Select Beta/options.lua:19: ‘end’ expected (to close ‘function’ at line 7) near ''
stack traceback:
[C]: ?
[C]: in function ‘error’
?: in function ‘gotoScene’
…focuslab/Desktop/Level Select Beta/splashscreen.lua:66: in function <…focuslab select beta>
?: in function <?:229>
I really appreciate the help, I’m home with the flu right now : (
[import]uid: 72845 topic_id: 34149 reply_id: 136959[/import] </…focuslab>

You need to learn to read your error messages and look for the cause.

options.lua:19: ‘end’ expected (to close ‘function’ at line 7) near ‘’

Line 19 is the last line and it’s looking for an “end” to close a function started on line 7.

Where is the rest of your storyboard scene? the “return scene” that has to be the last line? The other 3 functions? The addEventListener’s for the 4 functions? Its seems to me you’ve only have part of a file here.
[import]uid: 199310 topic_id: 34149 reply_id: 136960[/import]

You couldn’t be more right about me learning error messages. It’s people like you that are really making a difference in me understanding this stuff. I’ve always been keen for graphic design and it’s just recently I’ve started trying to code. After adding what I should have in the first place everything runs just fine. And thank you so much for explaining how to read the error message. That little bit just helped me resolve a few more issues I’ve been having. Again thanks a million! Your name will definitely be in my special thanks section. [import]uid: 72845 topic_id: 34149 reply_id: 136961[/import]

Once I create a new scene IE. level1world1 does storyboard still store my other scenes? The reason I ask is because in my level1world1.lua I’ve created a “Home” button which I’m calling the splashscreen.lua with but when I click it nothing happens.

Heres my code for the button:

local homebutton = display.newImage( "homebutton.png" )  
group:insert(homebutton)  
homebutton.x = display.contentWidth / 1.69  
homebutton.y = display.contentHeight / 13.2  
 local function homebuttontouched (event)  
 if ("ended" == event.phase) then  
 storyboard:gotoScene( "splashscreen", "fade" )   
 end   
 end  
  
homebutton.active = true  
local function homebuttontouched(e) if e.phase == "began" then  
e.target.alpha = .5  
end if e.phase == "ended" then  
e.target.alpha = 1 print("Home button was touched.")  
 end  
end  
  
homebutton:addEventListener( "touch", homebuttontouched )  
homebutton:addEventListener('tap', homebutton)  
  
--end home button  

This is at the top of my .lua

local storyboard = require( "storyboard" )  
local scene = storyboard.newScene()  
   
  
   
function scene:createScene( event )  
 local group = self.view  

and this is at the bottom

end  
  
function scene:enterScene( event )  
 local group = self.view  
   
end  
   
function scene:exitScene( event )  
 local group = self.view  
   
end  
   
function scene:destroyScene( event )  
 local group = self.view  
   
end  
scene:addEventListener( "createScene", scene )  
scene:addEventListener( "enterScene", scene )  
scene:addEventListener( "exitScene", scene )  
scene:addEventListener( "destroyScene", scene )  
   
return scene  

when I switch scenes from my splash screen (options/about section) and I click on an identical button to go back to the splash screen it works fine. just a bit confused.

EDIT:
Never mind solved the problem [import]uid: 72845 topic_id: 34149 reply_id: 137001[/import]

I’ve got a new dilemma. Not sure exactly why I’m getting the error but I’ll give you a run down of what’s going on before I post my report and luas. So I’m trying to expand on what we’ve been going over thus far and I wanted to add my own splash screen with a menu before loading the worlds.lua. I’ve added a “splash screen” but for some reason my “Play” button doesn’t change scene to the “Worlds” scene, and I’m getting errors before the splash screen appears.

TERMINAL REPORT:

2012-12-31 13:48:20.453 Corona Simulator[30126:903] WARNING: display.setStatusBarMode() not supported in the simulator for the current device
2012-12-31 13:48:20.454 Corona Simulator[30126:903] in load splashscreen file
2012-12-31 13:48:20.672 Corona Simulator[30126:903] Runtime error
?:0: attempt to concatenate global ‘sceneName’ (a nil value)
stack traceback:
[C]: ?
?: in function ‘gotoScene’
…s/focuslab/Desktop/Level Select Beta/main.lua:18: in main chunk
2012-12-31 13:48:20.672 Corona Simulator[30126:903] Runtime error:
2012-12-31 13:48:20.673 Corona Simulator[30126:903] ?:0: attempt to concatenate global ‘sceneName’ (a nil value)
stack traceback:
[C]: ?
?: in function ‘gotoScene’
…s/focuslab/Desktop/Level Select Beta/main.lua:18: in main chunk
2012-12-31 13:48:23.663 Corona Simulator[30126:903] Runtime error
…focuslab/Desktop/Level Select Beta/splashscreen.lua:48: attempt to call method ‘changeScene’ (a nil value)
stack traceback:
[C]: in function ‘changeScene’
…focuslab/Desktop/Level Select Beta/splashscreen.lua:48: in function <…focuslab select beta>
?: in function <?:229>

main.lua
<br>-----------------------------------------------------------------------------------------<br>--<br>-- main.lua<br>--<br>-----------------------------------------------------------------------------------------<br><br>-- hide the status bar<br>display.setStatusBar( display.HiddenStatusBar )<br><br>-- include the Corona "storyboard" module<br>local storyboard = require "storyboard"<br><br>-- Store the selected world and level<br>storyboard.world = 0<br>storyboard.level = 0<br><br>-- load menu screen<br>storyboard.gotoScene( "splashscreen" )<br>storyboard.isDebug = true<br>

and my splashscreen.lua
<br><br>local storyboard = require( "storyboard" )<br>display.setStatusBar(display.HiddenStatusBar)<br> print ("in load splashscreen file")<br> local localGroup = display.newGroup()<br><br>--BACKGROUND IMAGES <br> <br> local background = display.newImage("gnomiessplashbg.png")<br>localGroup:insert(background)<br>background.x = display.stageWidth / 2<br>background.y = display.stageHeight / 2 <br> <br>--media.playSound( "gnomiesmusic.mp3", true ) <br> <br> local backgroundbg2 = display.newImage("gnomiessplashbg2.png")<br>localGroup:insert(backgroundbg2)<br>backgroundbg2.x = display.stageWidth / 2<br>backgroundbg2.y = display.stageHeight / 2 <br>--BACKGROUND IMAGES END <br> <br> <br> <br> <br>--BUTTONS<br><br> local worlds = display.newImage("gnomiesPlaybutton.png" )<br> localGroup:insert(worlds)<br> <br>worlds.x = display.stageWidth / 1.9<br>worlds.y = display.stageHeight / 2.1 <br><br> <br>--END BUTTONS <br> <br> <br> <br> <br> <br> local function touched (event)<br> if ("ended" == event.phase) then<br> storyboard:changeScene( "worlds", "fade" ) <br> end <br> end<br> <br> worlds:addEventListener ("touch", touched)<br> <br>
And if I change
<br>storyboard.gotoScene( "splashscreen" )<br>
in the main.lua back to
<br>storyboard.gotoScene( "worlds" )<br>

everything works fine again, granted no splash screen. [import]uid: 72845 topic_id: 34149 reply_id: 136920[/import] </…focuslab>

It looks like to me that splashscreen.lua isn’t constructed as a storyboard module. All storyboard scenes must start with these two lines:

local storyboard = require( "storyboard" )  
local scene = storyboard.newScene()  

and must end with these lines:

scene:addEventListener( "createScene", scene )  
scene:addEventListener( "enterScene", scene )  
scene:addEventListener( "exitScene", scene )  
scene:addEventListener( "destroyScene", scene )  
  
return scene  

In addition you have to provide functions for each of those 4 event listeners (technically you don’t need to implement them, but if you don’t storyboard won’t work… In other words you could do everything in createScene and ignore the others, but you have to either do createScene or enterScene. If no storyboard has nothing to manage.

Since you are struggling with storyboard, lets go with these are required. The code for each of these functions looks like this:

function scene:createScene( event )  
 local group = self.view  
  
end  
  
function scene:enterScene( event )  
 local group = self.view  
  
end  
  
function scene:exitScene( event )  
 local group = self.view  
  
end  
  
function scene:destroyScene( event )  
 local group = self.view  
  
end  

Most of your work is going into the createScene function. For simple scenes, there is probably nothing to do in the other three. Your:

  
display.setStatusBar(display.HiddenStatusBar)  
 print ("in load splashscreen file")  
 local localGroup = display.newGroup()  
   
--BACKGROUND IMAGES   
  
 local background = display.newImage("gnomiessplashbg.png")  
localGroup:insert(background)  
background.x = display.stageWidth / 2  
background.y = display.stageHeight / 2   
  
--media.playSound( "gnomiesmusic.mp3", true )   
   
   
  
 local backgroundbg2 = display.newImage("gnomiessplashbg2.png")  
localGroup:insert(backgroundbg2)  
backgroundbg2.x = display.stageWidth / 2  
backgroundbg2.y = display.stageHeight / 2   
--BACKGROUND IMAGES END   
  
  
  
  
--BUTTONS  
   
 local worlds = display.newImage("gnomiesPlaybutton.png" )  
 localGroup:insert(worlds)  
  
worlds.x = display.stageWidth / 1.9  
worlds.y = display.stageHeight / 2.1   
   
   
   
   
--END BUTTONS   
   
   
   
   
   
 local function touched (event)  
 if ("ended" == event.phase) then  
 storyboard:changeScene( "worlds", "fade" )   
 end   
 end  
   
 worlds:addEventListener ("touch", touched)  
  

should be:

function scene:createScene( event )  
 local group = self.view  
  
 display.setStatusBar(display.HiddenStatusBar) -- print ("in load splashscreen file")  
 -- local localGroup = display.newGroup() -- -- need this since it's display.newGroup() is the "group"  
 -- four lines up.  
   
 --BACKGROUND IMAGES   
  
 local background = display.newImage("gnomiessplashbg.png")  
 group:insert(background) -- must be in the scene's view ("group") to be managed.  
 background.x = display.stageWidth / 2  
 background.y = display.stageHeight / 2   
  
 --media.playSound( "gnomiesmusic.mp3", true )   
  
 local backgroundbg2 = display.newImage("gnomiessplashbg2.png")  
 group:insert(backgroundbg2)  
 backgroundbg2.x = display.stageWidth / 2  
 backgroundbg2.y = display.stageHeight / 2   
 --BACKGROUND IMAGES END   
  
 --BUTTONS  
   
 local worlds = display.newImage("gnomiesPlaybutton.png" )  
 group:insert(worlds)  
  
 worlds.x = display.stageWidth / 1.9  
 worlds.y = display.stageHeight / 2.1   
   
 --END BUTTONS   
   
 local function touched (event)  
 if ("ended" == event.phase) then  
 storyboard:changeScene( "worlds", "fade" )   
 end   
 end  
   
 worlds:addEventListener ("touch", touched)  
end  

[import]uid: 199310 topic_id: 34149 reply_id: 136925[/import]

I appreciate the local group = self.view bit. I was using director before.
Just to make sure I’m on the right path here’s my splashscreen.lua now

local storyboard = require( "storyboard" )  
local scene = storyboard.newScene()  
  
 print ("in load splashscreen file")  
  
  
function scene:createScene( event )  
 local group = self.view  
   
end  
   
function scene:enterScene( event )  
 local group = self.view  
   
end  
   
function scene:exitScene( event )  
 local group = self.view  
   
end  
   
function scene:destroyScene( event )  
 local group = self.view  
   
end  
  
  
function scene:createScene( event )  
 local group = self.view  
   
 display.setStatusBar(display.HiddenStatusBar)   
 print ("in load splashscreen file")  
  
   
 --BACKGROUND IMAGES   
  
 local background = display.newImage("gnomiessplashbg.png")  
 group:insert(background) -- must be in the scene's view ("group") to be managed.  
 background.x = display.contentWidth / 2  
 background.y = display.contentHeight / 2   
  
 --media.playSound( "gnomiesmusic.mp3", true )   
  
 local backgroundbg2 = display.newImage("gnomiessplashbg2.png")  
 group:insert(backgroundbg2)  
 backgroundbg2.x = display.contentWidth / 2  
 backgroundbg2.y = display.contentHeight / 2   
 --BACKGROUND IMAGES END   
  
 --BUTTONS  
   
 local worlds = display.newImage("gnomiesPlaybutton.png" )  
 group:insert(worlds)  
  
 worlds.x = display.contentWidth / 1.9  
 worlds.y = display.contentHeight / 2.1   
   
 --END BUTTONS   
   
 local function touched (event)  
 if ("ended" == event.phase) then  
 storyboard:changeScene( "worlds", "fade" )   
 end   
 end  
   
 worlds:addEventListener ("touch", touched)  
end  
  
  
  
scene:addEventListener( "createScene", scene )  
scene:addEventListener( "enterScene", scene )  
scene:addEventListener( "exitScene", scene )  
scene:addEventListener( "destroyScene", scene )  
   
return scene  

Not 100% sure if this is the proper order to add the function scenes and add event listeners in. If it is correct I’m still getting this message in the terminal when I click the “play” button on the splash screen.

2012-12-31 14:54:19.669 Corona Simulator[30126:903] Runtime error
…focuslab/Desktop/Level Select Beta/splashscreen.lua:68: attempt to call method ‘changeScene’ (a nil value)
stack traceback:
[C]: in function ‘changeScene’
…focuslab/Desktop/Level Select Beta/splashscreen.lua:68: in function <…focuslab select beta>
?: in function <?:229>
Appreciate your help
[import]uid: 72845 topic_id: 34149 reply_id: 136932[/import] </…focuslab>

local storyboard = require( "storyboard" )  
local scene = storyboard.newScene()  
  
-- this will only happen once when the scene is first required.   
 print ("in load splashscreen file")  
  
function scene:createScene( event )  
 local group = self.view  
   
 display.setStatusBar(display.HiddenStatusBar)   
 print ("in load splashscreen file")  
  
   
 --BACKGROUND IMAGES   
  
 local background = display.newImage("gnomiessplashbg.png")  
 group:insert(background) -- must be in the scene's view ("group") to be managed.  
 background.x = display.contentWidth / 2  
 background.y = display.contentHeight / 2   
  
 --media.playSound( "gnomiesmusic.mp3", true )   
  
 local backgroundbg2 = display.newImage("gnomiessplashbg2.png")  
 group:insert(backgroundbg2)  
 backgroundbg2.x = display.contentWidth / 2  
 backgroundbg2.y = display.contentHeight / 2   
 --BACKGROUND IMAGES END   
  
 --BUTTONS  
   
 local worlds = display.newImage("gnomiesPlaybutton.png" )  
 group:insert(worlds)  
  
 worlds.x = display.contentWidth / 1.9  
 worlds.y = display.contentHeight / 2.1   
   
 --END BUTTONS   
   
 local function touched (event)  
 if ("ended" == event.phase) then  
 storyboard:gotoScene( "worlds", "fade" )   
 end   
 end  
   
 worlds:addEventListener ("touch", touched)  
end  
  
function scene:enterScene( event )  
 local group = self.view  
   
end  
   
function scene:exitScene( event )  
 local group = self.view  
   
end  
   
function scene:destroyScene( event )  
 local group = self.view  
   
end  
scene:addEventListener( "createScene", scene )  
scene:addEventListener( "enterScene", scene )  
scene:addEventListener( "exitScene", scene )  
scene:addEventListener( "destroyScene", scene )  
   
return scene  

changeScene() is a director method. storyboard uses gotoScene() [import]uid: 199310 topic_id: 34149 reply_id: 136934[/import]

Awesome!, thanks for clearing that up for me. 1 last thing. If I wanted to make multiple buttons how would I do that? I tried to just copy and change what I thought was needed but that appears to not be the case.

My fail attempt:

 local function playtouched (event)  
 if ("ended" == event.phase) then  
 storyboard:gotoScene( "worlds", "fade" )   
 end   
 end  
   
 worlds:addEventListener ("touch", playtouched)  
end  
  
 local function optionstouched (event)  
 if ("ended" == event.phase) then  
 storyboard:gotoScene( "options", "fade" )   
 end   
 end  
   
 options:addEventListener ("touch", optionstouched)  
end  
  
 local function abouttouched (event)  
 if ("ended" == event.phase) then  
 storyboard:gotoScene( "about", "fade" )   
 end   
 end  
   
 about:addEventListener ("touch", abouttouched)  
end  

I’m assuming the way I’m creating local function after local function is not the right way.
[import]uid: 72845 topic_id: 34149 reply_id: 136946[/import]

Can you post the full code. There are a bunch of ends that don’t need to be there. I don’t see where you are creating the buttons to attach the handlers too.

[import]uid: 199310 topic_id: 34149 reply_id: 136948[/import]

My appologies

[code]
local storyboard = require( “storyboard” )
local scene = storyboard.newScene()

– this will only happen once when the scene is first required.
print (“in load splashscreen file”)

function scene:createScene( event )
local group = self.view

display.setStatusBar(display.HiddenStatusBar)
print (“in load splashscreen file”)

–BACKGROUND IMAGES

local background = display.newImage(“gnomiessplashbg.png”)
group:insert(background) – must be in the scene’s view (“group”) to be managed.
background.x = display.contentWidth / 2
background.y = display.contentHeight / 2

–media.playSound( “gnomiesmusic.mp3”, true )

local backgroundbg2 = display.newImage(“gnomiessplashbg2.png”)
group:insert(backgroundbg2)
backgroundbg2.x = display.contentWidth / 2
backgroundbg2.y = display.contentHeight / 2
–BACKGROUND IMAGES END

–BUTTONS

local worlds = display.newImage(“gnomiesPlaybutton.png” )
group:insert(worlds)

worlds.x = display.contentWidth / 1.9
worlds.y = display.contentHeight / 2.1

local optionsbutton = display.newImage(“gnomiesOptionsbutton.png” )
group:insert(optionsbutton)

optionsbutton.x = display.stageWidth / 1.9
optionsbutton.y = display.stageHeight / 1.5

local aboutbutton = display.newImage(“gnomiesAboutbutton.png” )
group:insert(aboutbutton)

aboutbutton.x = display.stageWidth / 1.9
aboutbutton.y = display.stageHeight / 1.16

–END BUTTONS

local function playtouched (event)
if (“ended” == event.phase) then
storyboard:gotoScene( “worlds”, “fade” )
end
end

worlds:addEventListener (“touch”, playtouched)
end

local function optionstouched (event)
if (“ended” == event.phase) then
storyboard:gotoScene( “options”, “fade” )
end
end

options:addEventListener (“touch”, optionstouched)
end

local function abouttouched (event)
if (“ended” == event.phase) then
storyboard:gotoScene( “about”, “fade” )
end
end

about:addEventListener (“touch”, abouttouched)
end

function scene:enterScene( event )
local group = self.view

end

function scene:exitScene( event )
local group = self.view

end

function scene:destroyScene( event )
local group = self.view

end
scene:addEventListener( “createScene”, scene )
scene:addEventListener( “enterScene”, scene )
scene:addEventListener( “exitScene”, scene )
scene:addEventListener( “destroyScene”, scene )

return scene
[/code] [import]uid: 72845 topic_id: 34149 reply_id: 136952[/import]

You are pretty close. Keep in mind that in lua, chunks as they are know (blocks of code) have to have a matching end for each start. If you have a “function”, there is a matching “end”. If you have an “if” there is a matching end. You have a few extra “ends” in your code:

[code]
local storyboard = require( “storyboard” )
local scene = storyboard.newScene()

– this will only happen once when the scene is first required.
print (“in load splashscreen file”)

function scene:createScene( event )
local group = self.view

display.setStatusBar(display.HiddenStatusBar)
print (“in load splashscreen file”)

–BACKGROUND IMAGES

local background = display.newImage(“gnomiessplashbg.png”)
group:insert(background) – must be in the scene’s view (“group”) to be managed.
background.x = display.contentWidth / 2
background.y = display.contentHeight / 2

–media.playSound( “gnomiesmusic.mp3”, true )

local backgroundbg2 = display.newImage(“gnomiessplashbg2.png”)
group:insert(backgroundbg2)
backgroundbg2.x = display.contentWidth / 2
backgroundbg2.y = display.contentHeight / 2
–BACKGROUND IMAGES END

–BUTTONS

local worlds = display.newImage(“gnomiesPlaybutton.png” )
group:insert(worlds)

worlds.x = display.contentWidth / 1.9
worlds.y = display.contentHeight / 2.1

local optionsbutton = display.newImage(“gnomiesOptionsbutton.png” )
group:insert(optionsbutton)

optionsbutton.x = display.stageWidth / 1.9
optionsbutton.y = display.stageHeight / 1.5

local aboutbutton = display.newImage(“gnomiesAboutbutton.png” )
group:insert(aboutbutton)

aboutbutton.x = display.stageWidth / 1.9
aboutbutton.y = display.stageHeight / 1.16

–END BUTTONS

local function playtouched (event)
if (“ended” == event.phase) then
storyboard:gotoScene( “worlds”, “fade” )
end
end

worlds:addEventListener (“touch”, playtouched)
– end –
local function optionstouched (event)
if (“ended” == event.phase) then
storyboard:gotoScene( “options”, “fade” )
end
end

options:addEventListener (“touch”, optionstouched)
– end –
local function abouttouched (event)
if (“ended” == event.phase) then
storyboard:gotoScene( “about”, “fade” )
end
end

about:addEventListener (“touch”, abouttouched)
end

function scene:enterScene( event )
local group = self.view

end

function scene:exitScene( event )
local group = self.view

end

function scene:destroyScene( event )
local group = self.view

end
scene:addEventListener( “createScene”, scene )
scene:addEventListener( “enterScene”, scene )
scene:addEventListener( “exitScene”, scene )
scene:addEventListener( “destroyScene”, scene )

return scene
[/code] [import]uid: 199310 topic_id: 34149 reply_id: 136957[/import]

Alright now that that’s cleared up. For some reason it’s still not working : (

my splashscreen.lua is exactly as the one you posted and my options.lua is

local storyboard = require( "storyboard" )  
local scene = storyboard.newScene()  
   
-- this will only happen once when the scene is first required.   
 print ("in load splashscreen file")  
   
function scene:createScene( event )  
 local group = self.view  
   
 display.setStatusBar(display.HiddenStatusBar)   
 print ("in load splashscreen file")  
  
   
 --BACKGROUND IMAGES   
  
 local background = display.newImage("gnomiessplashbg.png")  
 group:insert(background) -- must be in the scene's view ("group") to be managed.  
 background.x = display.contentWidth / 2  
 background.y = display.contentHeight / 2   

I just did something minimal to see if it would work.

Here’s what the terminal is telling me:

error loading module ‘options’ from file ‘/Users/focuslab/Desktop/Level Select Beta/options.lua’:
/Users/focuslab/Desktop/Level Select Beta/options.lua:19: ‘end’ expected (to close ‘function’ at line 7) near ''
stack traceback:
[C]: ?
[C]: in function ‘error’
?: in function ‘gotoScene’
…focuslab/Desktop/Level Select Beta/splashscreen.lua:66: in function <…focuslab select beta>
?: in function <?:229>
I really appreciate the help, I’m home with the flu right now : (
[import]uid: 72845 topic_id: 34149 reply_id: 136959[/import] </…focuslab>

You need to learn to read your error messages and look for the cause.

options.lua:19: ‘end’ expected (to close ‘function’ at line 7) near ‘’

Line 19 is the last line and it’s looking for an “end” to close a function started on line 7.

Where is the rest of your storyboard scene? the “return scene” that has to be the last line? The other 3 functions? The addEventListener’s for the 4 functions? Its seems to me you’ve only have part of a file here.
[import]uid: 199310 topic_id: 34149 reply_id: 136960[/import]

You couldn’t be more right about me learning error messages. It’s people like you that are really making a difference in me understanding this stuff. I’ve always been keen for graphic design and it’s just recently I’ve started trying to code. After adding what I should have in the first place everything runs just fine. And thank you so much for explaining how to read the error message. That little bit just helped me resolve a few more issues I’ve been having. Again thanks a million! Your name will definitely be in my special thanks section. [import]uid: 72845 topic_id: 34149 reply_id: 136961[/import]