I am creating the start menu for my app . I am trying to make it so that when you press the play button you start the game ( but in corona’s case go to game.lua file ). this is my code:
local composer = require( “composer” )
– display background image
local background = display.newImage( “background.png” )
background.x = 10; background.y = 308
– display ground image
local ground = display.newImage( “ground.png” )
ground.x = 145; ground.y = 480
– display logo image
local logo = display.newImageRect( “logo.png”, 250, 150 )
logo.x = 160 logo.y = 7
– display play button
local button = display.newImageRect( “button.png”, 100, 100 )
button.x = 160 button.y = 350
local function
onbuttonRelease()
composer:gotoScene( “game” )
end
function
scene:createScene(event)
local group = self.view
group:insert(background)
group:insert(logo)
group:insert(button)
group:insert(ground)
end
function game:enterScene( game )
local group = self.view
end
function scene:exitScene( game )
local group = self.view
composer.removeScene( “main” )
end
function scene:destroyScene( game )
local group = self.view
end
scene:addEventListener( “createScene”, scene )
scene:addEventListener( “enterScene”, scene )
scene:addEventListener( “exitScene”, scene )
scene:addEventListener( “destroyScene”, scene )
return scene
:I am getting this message when I relaunch :
main.lua:24:attempt to index global ‘scene’ (a nil value)
stack traceback
main.lua:24:in main chunk
Do you want to restart project ?
:what am I doing wrong what code should I have ? why am I getting this error ?