Sorry If I posted on the wrong section or if this has been solved before but my problem is;
My Code keeps saying unexpected symbol near ‘.’ and I have no idea what the problem is
a screeny of the error
Settings Code
[spoiler]
– Created by: Nick Porter
– Created on: Dec 2013
– Created for: ICS2O
– This program display Settings
–
– Settings.lua
–
local storyboard = require( “storyboard” )
local scene = storyboard.newScene()
local backgroundImage
display.setDefault(“background”,225,225, 225)
storyboard.purgeOnSceneChange = true
display.setStatusBar(display.HiddenStatusBar)
– local functions go here
– When sound is touched
function onImageTouch(self, event)
if(event.phase == “began”) then
if (soundOn.isVisible == true)
then
soundOn.isVisible = false
soundOff.isVisible = true
else
soundOn.isVisible = true
soundOff.isVisible = false
end
end
return true
end
– When music is touched
function onImageTouch(self, event)
if(event.phase == “began”) then
if (musicOn.isVisible == true)
then
musicOn.isVisible = false
musicOff.isVisible = true
else
musicOn.isVisible = true
musicOff.isVisible = false
end
end
return true
end
– When notifications is touched
function onImageTouch(self, event)
if(event.phase == “began”) then
if (notificationsOn.isVisible)
then
notificationsOn.isVisible = false
notificationsOff.isVisible = true
else
notificationsOn.isVisible = true
notificationsOff.isVisible = false
end
end
return true
end
local function backButtonTouch(event)
if(event.phase == “ended”) then
storyboard.gotoScene(‘MainMenu’)
end
end
local backgroundImage = display.newImageRect("./images/background.png" , 1024, 768)
backgroundImage.x = display.contentWidth/2
backgroundImage.y = display.contentHeight/2
group:insert(backgroundImage)
local sound = display.newImageRect("./images/sound.png", 176,88)
sound.x = 500
sound.y = 200
group:insert(sound)
sound.touch = onImageTouch
sound:addEventListener(“touch”, image)
local soundOff = display.newImageRect("./images/off.png", 91,52)
soundOff.x = 500
soundOff.y = 300
group:insert(soundOff)
local soundOn = display.newImageRect("./images/on.png", 91,52)
soundOn.x = 500
soundOn.y = 300
group:insert(soundOn)
local music = display.newImageRect("./images/music.png", 176,88)
music.x = 500
music.y = 400
group:insert(music)
music.touch = onImageTouch
music:addEventListener(“touch”, image)
local musicOff = display.newImageRect("./images/off.png", 91,52)
musicOff.x = 500
musicOff.y = 500
group:insert(musicOff)
local musicOn = display.newImageRect("./images/on.png", 91,52)
musicOn.x = 500
musicOn.y = 500
group:insert(musicOn)
local notifications = display.newImageRect("./images/notifications.png", 176,88)
notifications.x = 500
notifications.y = 600
group:insert(notifications)
notifications.touch = onImageTouch
notifications:addEventListener(“touch”, image)
local notificationsOff = display.newImageRect("./images/off.png", 91,52)
notificationsOff.x = 500
notificationsOff.y = 700
group:insert(notificationsOff)
local notificationsOn = display.newImageRect("./images/on.png", 91,52)
notificationsOn.x = 500
notificationsOn.y = 700
group:insert(notificationsOn)
local backButton = display.newImageRect("./images/backButton.png", 176, 176)
local backButton.x = 100
local backButton.y = 650
backButton.isVisible = true
returnButton:addEventListener ( “touch”, backButton )
group:insert(backButton)
–
– NOTE:
–
– Code outside of listener functions (below) will only be executed once,
–
– BEGINNING OF YOUR IMPLEMENTATION
– Called when the scene’s view does not exist:
function scene:createScene( event )
local group = self.view
-----------------------------------------------------------------------------
– CREATE display objects and add them to ‘group’ here.
– Example use-case: Restore ‘group’ from previously saved state.
-----------------------------------------------------------------------------
end
– Called immediately after scene has moved onscreen:
function scene:enterScene( event )
local group = self.view
print( “1: enterScene event” )
-----------------------------------------------------------------------------
– INSERT code here (e.g. start timers, load audio, start listeners, etc.)
-----------------------------------------------------------------------------
end
– Called when scene is about to move offscreen:
function scene:exitScene( event )
print( “1: exitScene event” )
-----------------------------------------------------------------------------
– INSERT code here (e.g. stop timers, remove listeners, unload sounds, etc.)
-----------------------------------------------------------------------------
end
– Called prior to the removal of scene’s “view” (display group)
function scene:destroyScene( event )
local group = self.view
print( “((destroying scene 1’s view))” )
– INSERT code here (e.g. remove listeners, widgets, save state, etc.)
end
– END OF YOUR IMPLEMENTATION
– “createScene” event is dispatched if scene’s view does not exist
scene:addEventListener( “createScene”, scene )
– “enterScene” event is dispatched whenever scene transition has finished
scene:addEventListener( “enterScene”, scene )
– “exitScene” event is dispatched before next scene’s transition begins
scene:addEventListener( “exitScene”, scene )
– “destroyScene” event is dispatched before view is unloaded, which can be
– automatically unloaded in low memory situations, or explicitly via a call to
– storyboard.purgeScene() or storyboard.removeScene().
scene:addEventListener( “destroyScene”, scene )
return scene
[/spoiler]
Main Menu Code]
[spoiler]
– Created by: Jason Damasco
– Created on: Nov 2013
– Created for: ICS2O
– This program display Main Menu
–
– MainMenu.lua
–
local storyboard = require( “storyboard” )
local scene = storyboard.newScene()
local backgroundImage
display.setDefault(“background”,225,225, 225)
storyboard.purgeOnSceneChange = true
display.setStatusBar(display.HiddenStatusBar)
– local functions go here
local function playButtonTouch(event)
if(event.phase == “ended”) then
storyboard.gotoScene(‘Game’)
end
end
local function settingsButtonTouch(event)
if(event.phase == “ended”) then
storyboard.gotoScene(‘Settings’)
end
end
–
– NOTE:
–
– Code outside of listener functions (below) will only be executed once,
–
– BEGINNING OF YOUR IMPLEMENTATION
– Called when the scene’s view does not exist:
function scene:createScene( event )
local group = self.view
-----------------------------------------------------------------------------
– CREATE display objects and add them to ‘group’ here.
– Example use-case: Restore ‘group’ from previously saved state.
-----------------------------------------------------------------------------
local backgroundImage = display.newImageRect("./images/background.png" , 1024, 768)
backgroundImage.x = display.contentWidth/2
backgroundImage.y = display.contentHeight/2
group:insert(backgroundImage)
local titleImage = display.newImageRect ("./images/mainMenu.png", 1024, 768)
local myImageWidth = titleImage.width
local myImageHeight = titleImage.height
titleImage.x = 575
titleImage.y = 400
group:insert(titleImage)
local playButton = display.newImageRect ("./images/playButton.png", 176, 88)
local playButtonWidth = playButton.width
local playButtonHeight = playButton.height
playButton:addEventListener ( “touch”, playButtonTouch )
playButton.x = 515
playButton.y = 300
group:insert(playButton)
local settingsButton = display.newImageRect ("./images/settings.png", 176, 176)
local settingsButtonWidth = settingsButton.width
local settingsButtonHeight = settingsButton.height
settingsButton:addEventListener ( “touch”, settingsButtonTouch )
settingsButton.x = 85
settingsButton.y = 689
group:insert(settingsButton)
end
– Called immediately after scene has moved onscreen:
function scene:enterScene( event )
local group = self.view
print( “1: enterScene event” )
-----------------------------------------------------------------------------
– INSERT code here (e.g. start timers, load audio, start listeners, etc.)
-----------------------------------------------------------------------------
end
– Called when scene is about to move offscreen:
function scene:exitScene( event )
print( “1: exitScene event” )
-----------------------------------------------------------------------------
– INSERT code here (e.g. stop timers, remove listeners, unload sounds, etc.)
-----------------------------------------------------------------------------
end
– Called prior to the removal of scene’s “view” (display group)
function scene:destroyScene( event )
local group = self.view
print( “((destroying scene 1’s view))” )
– INSERT code here (e.g. remove listeners, widgets, save state, etc.)
end
– END OF YOUR IMPLEMENTATION
– “createScene” event is dispatched if scene’s view does not exist
scene:addEventListener( “createScene”, scene )
– “enterScene” event is dispatched whenever scene transition has finished
scene:addEventListener( “enterScene”, scene )
– “exitScene” event is dispatched before next scene’s transition begins
scene:addEventListener( “exitScene”, scene )
– “destroyScene” event is dispatched before view is unloaded, which can be
– automatically unloaded in low memory situations, or explicitly via a call to
– storyboard.purgeScene() or storyboard.removeScene().
scene:addEventListener( “destroyScene”, scene )
return scene
[/spoiler]
And If anyone could help me with the “gotoScene” error that would be great!