On my main menu I am trying to add the play button feature and keep in mind this is a non-widget play button . I tried to make it so that my play button in the menu.lua file takes me to the level1.lua file and im getting an error .
menu.lua Code :
local storyboard = require( "storyboard" ) local scene = storyboard.newScene() function scene:createScene( event ) local group = self.view -- 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 play button local button = display.newImageRect( "button.png", 100, 80 ) button.x = 160 button.y = 300 -- display logo image local logo = display.newImageRect( "logo.png", 300, 200 ) logo.x = 160 logo.y = 20 local booton = display.newImage( "booton.png" ) booton.x = 160 booton.y = 400 group:insert( background ) group:insert( ground ) group:insert( button ) group:insert( logo ) group:insert(booton) 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 function booton:touch(event) if event.phase == "began" then elseif event.phase == "ended" then storyboard.gotoScene("level1", "fade", 500) return true end
level1.lua Code :
local storyboard = require( "storyboard" ) local scene = storyboard.newScene() function scene:createScene( event ) local group = self.view local physics = require( "physics" ) physics.start() physics.setGravity(0, 7) -- 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 physics.addBody( ground, "static" , { friction=0.5, bounce=0.1 } ) -- create object local myObject = display.newRect( 0, 0, 100, 30 ) myObject:setFillColor( 0 ) myObject.x = 145; myObject.y = 400 physics.addBody( myObject, "kinematic" , { myObject, friction=0.5, bounce=1 } ) -- touch listener function function myObject:touch( event ) if event.phase == "moved" then self.x = event.x self.y = event.y end return true end -- make 'myObject' listen for touch events myObject:addEventListener( "touch", myObject ) -- display ball image local ball = display.newImageRect( "ball.png", 81, 60 ) ball.x, ball.y = 145, 200 ball.rotation = .5 -- add physics to the ball physics.addBody( ball, { "dynamic" ,density=1000, friction=0.3, bounce=0.1 } ) local wall = display.newImageRect( "wall.png", 100, 10 ) wall.x, wall.y = -6, 387 wall.rotation = 90 physics.addBody( wall, "static" , { wall, friction=0.5, bounce=1 } ) local wall = display.newImageRect( "wall.png", 100, 10 ) wall.x, wall.y = -6, 300 wall.rotation = 90 physics.addBody( wall, "static" , { wall, friction=0.5, bounce=1 } ) local wall = display.newImageRect( "wall.png", 100, 10 ) wall.x, wall.y = -6, 202 wall.rotation = 90 physics.addBody( wall, "static" , { wall, friction=0.5, bounce=1 } ) local wall = display.newImageRect( "wall.png", 100, 10 ) wall.x, wall.y = -6, 104 wall.rotation = 90 physics.addBody( wall, "static" , { wall, friction=0.5, bounce=1 } ) local wall = display.newImageRect( "wall.png", 100, 10 ) wall.x, wall.y = -6, 7 wall.rotation = 90 physics.addBody( wall, "static" , { wall, friction=0.5, bounce=1 } ) local wall = display.newImageRect( "wall.png", 100, 10 ) wall.x, wall.y = 50, -49 physics.addBody( wall, "static" , { wall, friction=0.5, bounce=1 } ) local wall = display.newImageRect( "wall.png", 100, 10 ) wall.x, wall.y = 135, -49 physics.addBody( wall, "static" , { wall, friction=0.5, bounce=1 } ) local wall = display.newImageRect( "wall.png", 100, 10 ) wall.x = 232 wall.y = -49 physics.addBody( wall, "static" , { wall, friction=0.5, bounce=1 } ) local wall = display.newImageRect( "wall.png", 100, 10 ) wall.x = 335 wall.y = -49 physics.addBody( wall, "static" , { wall, friction=0.5, bounce=1 } ) local wall = display.newImageRect( "wall.png", 100, 10 ) wall.rotation = 90 wall.x = 325 wall.y = 3 physics.addBody( wall, "static" , { wall, friction=0.5, bounce=1 } ) local wall = display.newImageRect( "wall.png", 100, 10 ) wall.rotation = 90 wall.x = 325 wall.y = 98 physics.addBody( wall, "static" , { wall, friction=0.5, bounce=1 } ) local wall = display.newImageRect( "wall.png", 100, 10 ) wall.x = 325 wall.y = 195 wall.rotation = 90 physics.addBody( wall, "static" , { wall, friction=0.5, bounce=1 } ) local wall = display.newImageRect( "wall.png", 100, 10 ) wall.rotation = 90 wall.x = 325 wall.y = 292 physics.addBody( wall, "static" , { wall, friction=0.5, bounce=1 } ) local wall = display.newImageRect( "wall.png", 100, 10 ) wall.rotation = 90 wall.x = 325 wall.y = 387 physics.addBody( wall, "static" , { wall, friction=0.5, bounce=4 } ) group:insert(background) group:insert(ground) group:insert(myObject) group:insert(ball) group:insert(wall) group:insert(wall) group:insert(wall) group:insert(wall) group:insert(wall) group:insert(wall) group:insert(wall) group:insert(wall) group:insert(wall) group:insert(wall) group:insert(wall) group:insert(wall) group:insert(wall) group:insert(wall) 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
Windows simulator build date: Nov 18 2014 @ 18:35:32
Platform: SM-G900S / x64 / 6.2 / Intel® HD Graphics / 4.0.0 - Build 10.18.10.3
408 / 2014.2511
WARNING: display.setStatusBarMode() not supported in the simulator for SM-G900S
device
Copyright © 2009-2014 C o r o n a L a b s I n c .
Version: 3.0.0
Build: 2014.2511
Platform: SM-G900S / x64 / 6.2 / Intel® HD Graphics / 4.0.0 - Build 10.18.10.3
408 / 2014.2511
WARNING: display.setStatusBarMode() not supported in the simulator for SM-G900S
device
Copyright © 2009-2014 C o r o n a L a b s I n c .
Version: 3.0.0
Build: 2014.2511
Platform: SM-G900S / x64 / 6.2 / Intel® HD Graphics / 4.0.0 - Build 10.18.10.3
408 / 2014.2511
WARNING: display.setStatusBarMode() not supported in the simulator for SM-G900S
device
Runtime error
error loading module ‘menu’ from file ‘c:\users\true\documents\corona projects\b
ouncy balls\menu.lua’:
c:\users\true\documents\corona projects\bouncy balls\menu.lua:53: '<eof>
’ expected near ‘function’
stack traceback:
[C]: in function ‘error’
?: in function ‘gotoScene’
c:\users\true\documents\corona projects\bouncy balls\main.lua:16: in mai
n chunk
Copyright © 2009-2014 C o r o n a L a b s I n c .
Version: 3.0.0
Build: 2014.2511
Platform: SM-G900S / x64 / 6.2 / Intel® HD Graphics / 4.0.0 - Build 10.18.10.3
408 / 2014.2511
WARNING: display.setStatusBarMode() not supported in the simulator for SM-G900S
device
Runtime error
error loading module ‘menu’ from file ‘c:\users\true\documents\corona projects\b
ouncy balls\menu.lua’:
c:\users\true\documents\corona projects\bouncy balls\menu.lua:53: '<eof>
’ expected near ‘function’
stack traceback:
[C]: in function ‘error’
?: in function ‘gotoScene’
c:\users\true\documents\corona projects\bouncy balls\main.lua:16: in mai
n chunk
Copyright © 2009-2014 C o r o n a L a b s I n c .
Version: 3.0.0
Build: 2014.2511
Platform: SM-G900S / x64 / 6.2 / Intel® HD Graphics / 4.0.0 - Build 10.18.10.3
408 / 2014.2511
WARNING: display.setStatusBarMode() not supported in the simulator for SM-G900S
device
Runtime error
error loading module ‘menu’ from file ‘c:\users\true\documents\corona projects\b
ouncy balls\menu.lua’:
c:\users\true\documents\corona projects\bouncy balls\menu.lua:53: '<eof>
’ expected near ‘function’
stack traceback:
[C]: in function ‘error’
?: in function ‘gotoScene’
c:\users\true\documents\corona projects\bouncy balls\main.lua:16: in mai
n chunk
Copyright © 2009-2014 C o r o n a L a b s I n c .
Version: 3.0.0
Build: 2014.2511
Platform: SM-G900S / x64 / 6.2 / Intel® HD Graphics / 4.0.0 - Build 10.18.10.3
408 / 2014.2511
WARNING: display.setStatusBarMode() not supported in the simulator for SM-G900S
device
Runtime error
error loading module ‘menu’ from file ‘c:\users\true\documents\corona projects\b
ouncy balls\menu.lua’:
c:\users\true\documents\corona projects\bouncy balls\menu.lua:53: '<eof>
’ expected near ‘function’
stack traceback:
[C]: in function ‘error’
?: in function ‘gotoScene’
c:\users\true\documents\corona projects\bouncy balls\main.lua:16: in mai
n chunk
Copyright © 2009-2014 C o r o n a L a b s I n c .
Version: 3.0.0
Build: 2014.2511
Platform: SM-G900S / x64 / 6.2 / Intel® HD Graphics / 4.0.0 - Build 10.18.10.3
408 / 2014.2511
WARNING: display.setStatusBarMode() not supported in the simulator for SM-G900S
device
Runtime error
error loading module ‘menu’ from file ‘c:\users\true\documents\corona projects\b
ouncy balls\menu.lua’:
c:\users\true\documents\corona projects\bouncy balls\menu.lua:53: '<eof>
’ expected near ‘function’
stack traceback:
[C]: in function ‘error’
?: in function ‘gotoScene’
c:\users\true\documents\corona projects\bouncy balls\main.lua:16: in mai
n chunk
Copyright © 2009-2014 C o r o n a L a b s I n c .
Version: 3.0.0
Build: 2014.2511
Platform: SM-G900S / x64 / 6.2 / Intel® HD Graphics / 4.0.0 - Build 10.18.10.3
408 / 2014.2511
WARNING: display.setStatusBarMode() not supported in the simulator for SM-G900S
device
Runtime error
error loading module ‘menu’ from file ‘c:\users\true\documents\corona projects\b
ouncy balls\menu.lua’:
c:\users\true\documents\corona projects\bouncy balls\menu.lua:54: '<eof>
’ expected near ‘function’
stack traceback:
[C]: in function ‘error’
?: in function ‘gotoScene’
c:\users\true\documents\corona projects\bouncy balls\main.lua:16: in mai
n chunk
Copyright © 2009-2014 C o r o n a L a b s I n c .
Version: 3.0.0
Build: 2014.2511
Platform: SM-G900S / x64 / 6.2 / Intel® HD Graphics / 4.0.0 - Build 10.18.10.3
408 / 2014.2511
WARNING: display.setStatusBarMode() not supported in the simulator for SM-G900S
device
Runtime error
error loading module ‘menu’ from file ‘c:\users\true\documents\corona projects\b
ouncy balls\menu.lua’:
c:\users\true\documents\corona projects\bouncy balls\menu.lua:54: '<eof>
’ expected near ‘function’
stack traceback:
[C]: in function ‘error’
?: in function ‘gotoScene’
c:\users\true\documents\corona projects\bouncy balls\main.lua:16: in mai
n chunk