So I'm making an app in Corona SDK and I'm getting an error when I click my button that is trying to load up my first level.
Here are my codes:
main.lua
local storyboard = require "storyboard"
storyboard.gotoScene("menu")
menu.lua
local storyboard = require ("storyboard")
local scene = storyboard.newScene()
function scene:createScene( event )
local screenGroup = self.view
-- Background
bg = display.newImage("images/bg.png")
bg.x = display.contentCenterX
bg.y = display.contentCenterY
screenGroup:insert(bg)
-- Title
title = display.newImage("images/title.png")
title.x = display.contentCenterX
title.y = display.contentCenterY - 100
screenGroup:insert(title)
-- Play game
play = display.newImage("images/playgame.png")
play.x = display.contentCenterX - 170
play.y = display.contentCenterY - 27
screenGroup:insert(play)
-- About Us
about = display.newImage("images/about.png")
about.x = display.contentCenterX - 100
about.y = display.contentCenterY + 40
screenGroup:insert(about)
-- Level Select
select = display.newImage("images/select.png")
select.x = display.contentCenterX
select.y = display.contentCenterY + 100
screenGroup:insert(select)
end
function start(event)
if event.phase == "began" then
storyboard.gotoScene("level1", "fade", 400)
end
end
function start2(event)
if event.phase == "began" then
storyboard.gotoScene("about", "fade", 400)
end
end
function start3(event)
if event.phase == "began" then
storyboard.gotoScene("selectlvl", "fade", 400)
end
end
function scene:enterScene(event)
play:addEventListener("touch", start)
about:addEventListener("touch", start2)
select:addEventListener("touch", start3)
end
scene:addEventListener( "createScene", scene )
scene:addEventListener( "enterScene", scene )
return scene
And I have 0 code in my level1.lua
The error that I'm getting is this:
Runtime error
?:0: attempt to concatenate global 'sceneName' (a nil value)
stack traceback:
[C]: ?
?: in function 'gotoScene'
...s\corona projects\stickman obsticale course\menu.lua.42: in function
<...s\corona projects\stickman obsticale course\menu.
Thanks for reading and I hope you can find an answer, because I can't :)