I am new to Corona, and I am having some trouble with ‘gotoscene’
What I want is for a a button in ‘main.lua’ to make ‘about.lua’ appear.
-- main.lua local widget = require( "widget" ) -- get's widgets (for buttons) local storyboard = require ( "storyboard" ) -- get's stuff for screen changing local scene = storyboard.newScene( "about" ) -- ===============================DISPLAY==========================================-- local background = display.newImage( "mainscreen.png" ) background.x = display.contentCenterX background.y = display.contentCenterY display.setStatusBar(display.HiddenStatusBar) -- ================================Buttons/Places to go to ========================-- local logo = display.newImage( "logo.png", 160, 66 ) local About = display.newImage( "about.png", 160, 300 ) local function playgame( event ) local phase = phase if "ended" == phase then print( "You pressed the button" ) end end local play = widget.newButton { top = 160, width = 320, height = 66, defaultFile = "play.png", overFile = "playdown.png", onRelease = playgame, } local function about(event) storyboard.gotoScene( "about", {"Fade", 500} ) return true end local about = widget.newButton { top = 280, width = 320, height = 66, defaultFile = "about.png", overFile = "aboutdown.png", onRelease = about }
When is is all done, I will make it neat. I space things out to concentrate on them. Here is the about.lua:
-- about.lua local storyboard = require ( "storyboard" ) local scene = storyboard.newScene() local widget = require ( "widget" ) local background = display.newImage( "logo.png" ) background.x = display.contentCenterX background.y = display.contentCenterY