i’m a newby of corona for sure, but i’m not able to find the reason
why my code works perfectly on the simulator , BUT once compiled and installed on Phone/Tablet
i get an error : “This application encountered a Lua error…”
I’m trying to build a multi menu’ level selector for a game , using storyboard. maybe some one can help me. Maybe i’ve not understood the story board api , but neither the description or tutorials about it are complete or completely clear.
Thanks in advance for the help.
main.lua
display.setStatusBar ( display.HiddenStatusBar )
local storyboard = require ( “storyboard” )
storyboard.gotoScene ( “Intro” )
intro.lua
display.setStatusBar ( display.HiddenStatusBar )
local storyboard = require (“storyboard”)
local scene = storyboard.newScene()
– Create Scene Function
function scene:createScene(event)
local screenGroup = self.view
background = display.newImage(“sfondolegno.png”)
screenGroup:insert(background)
startbutt = display.newImage(“START.png”)
startbutt.x = display.contentWidth / 2
startbutt.y = display.contentHeight / 2 +100
screenGroup:insert(startbutt)
end
function start(event)
if event.phase == “began” then
storyboard.gotoScene (“menu”, “fade” , 200)
end
end
– Enter Scene Function
function scene:enterScene(event)
local previous_scene = storyboard.getPrevious()
storyboard.removeScene( previous_scene )
startbutt:addEventListener ( “touch”, start )
end
– Exit Scene Function
function scene:exitScene(event)
startbutt:removeEventListener ( “touch”, start )
end
– Destroy Scene Function
function scene:destroyScene(event)
end
scene:addEventListener ( “createScene”, scene)
scene:addEventListener ( “enterScene”, scene)
scene:addEventListener ( “exitScene”, scene)
scene:addEventListener ( “destroyScene”, scene)
return scene
menu.lua
display.setStatusBar ( display.HiddenStatusBar )
– requires
local storyboard = require “storyboard”
local scene = storyboard.newScene()
function scene:createScene(event)
local DX = display.contentWidth /24
local DY = display.contentHeight/40
local screenGroup = self.view
local background = display.newImage(“sfondomenu.png”)
background.x = display.contentWidth / 2
background.y = display.contentHeight / 2
background.alpha =1
screenGroup:insert(background)
button01 = display.newImage(“LVL01.png”)
button01.x = 4*DX
button01.y = 13*DY
screenGroup:insert(button01)
end
function start01(event)
if event.phase == “began” then
storyboard.gotoScene (“LVL1”, “fade” , 200)
end
end
function scene:enterScene(event)
local previous_scene = storyboard.getPrevious()
storyboard.removeScene( previous_scene )
button01:addEventListener ( “touch”, start01)
end
function scene:exitScene(event)
button01:removeEventListener ( “touch”, start01)
end
function scene:destroyScene(event)
end
scene:addEventListener ( “createScene”, scene)
scene:addEventListener ( “enterScene”, scene)
scene:addEventListener ( “exitScene”, scene)
scene:addEventListener ( “destroyScene”, scene)
return scene
LVL1.lua
display.setStatusBar ( display.HiddenStatusBar )
local storyboard = require (“storyboard”)
local scene = storyboard.newScene()
function scene:createScene(event)
local screenGroup = self.view
background = display.newImage(“sfondo.png”)
screenGroup:insert(background)
button01 = display.newImage(“LVL01.png”)
button01.x = display.contentWidth / 2
button01.y = display.contentHeight / 2
screenGroup:insert(button01)
end
function back_to_menu(event)
if event.phase == “began” then
storyboard.gotoScene (“menu”, “fade” , 200)
end
end
function scene:enterScene(event)
local previous_scene = storyboard.getPrevious()
storyboard.removeScene( previous_scene )
button01:addEventListener ( “touch”, back_to_menu )
end
function scene:exitScene(event)
button01:removeEventListener ( “touch”, back_to_menu )
end
function scene:destroyScene(event)
end
scene:addEventListener ( “createScene”, scene)
scene:addEventListener ( “enterScene”, scene)
scene:addEventListener ( “exitScene”, scene)
scene:addEventListener ( “destroyScene”, scene)
return scene