error in reset scene pls help me
--------------lvl6.lua----------------
display.setStatusBar(display.HiddenStatusBar)
local composer = require( “composer” )
local physics = require “physics”
physics.start()
local scene = composer.newScene()
local widget = require( “widget” )
local background
function onEventListenerPouse(event)
composer.gotoScene(“pouselvl6”, “fade”,800)
end
function scene:create( event )
local sceneGroup = self.view
background = display.newImage(“backgrounds/back.jpg”,480,270)
sceneGroup:insert(background)
local buttonPouse = widget.newButton({
with = 50,
height = 50,
defaultFile = “buttons/pause.png”,
overFile = “buttons/pause1.png”,
onEvent= onEventListenerPouse
})
buttonPouse.x = 900
buttonPouse.y = 60
sceneGroup:insert (buttonPouse)
local halfW = (display.contentWidth*0.5)
local halfH = (display.contentHeight*0.5)
–SCORE–
score = 0
local scoreText = display.newText( score, 75, 50, “GROBOLD.ttf”, 40 )
scoreText:setFillColor( 0, 0.5, 1 )
sceneGroup:insert(scoreText)
local function balloonTouched(event)
if (event.phase== “began”) then
Runtime:removeEventListener(“enterFrame”, event.self)
event.target:removeSelf()
score = score + 1
scoreText.text = score
end
end
local function bombTouched(event)
if (event.phase== “began”) then
Runtime:removeEventListener(“enterFrame”, event.self)
event.target:removeSelf()
score = math.floor (score - 1)
scoreText.text = score
end
end
local function offscreen(self, event)
if(self.y == nil) then
return
end
if(self.y>display.contentHeight + 50)then
Runtime:removeEventListener(“enterFrame”, self)
self:removeSelf()
end
end
local function addNewBalloonOrBomb()
local startX = math.random(display.contentWidth*0.1, display.contentWidth*0.9)
if(math.random(1,5)==1) then
–BOMB–
local bomb = display.newImage(“bomb1.png”, startX, -300)
physics.addBody(bomb)
bomb.enterFrame = offscreen
bomb:addEventListener(“touch”, bombTouched)
Runtime:addEventListener(“enterFrame”, bomb)
sceneGroup:insert(bomb)
else
–BALLOON–
local balloon = display.newImage(“phflag.png”, startX, -300)
physics.addBody( balloon )
balloon.enterFrame = offscreen
balloon:addEventListener(“touch”, balloonTouched)
Runtime:addEventListener(“enterFrame”, balloon)
sceneGroup:insert(balloon)
end
end
addNewBalloonOrBomb()
timer.performWithDelay(500,addNewBalloonOrBomb, 0)
–TIMER–
local secondsLeft = 3 * 60
local clockText = display.newText(“3:00”, display.contentCenterX, 50, “GROBOLD.ttf”, 40)
clockText:setFillColor( 0.7, 0.7, 1 )
local function updateTime()
secondsLeft = secondsLeft - 1
local minutes = math.floor( secondsLeft / 60 )
local seconds = secondsLeft % 60
local timeDisplay = string.format( “%02d:%02d”, minutes, seconds )
clockText.text = timeDisplay
end
local countDownTimer = timer.performWithDelay( 1000, updateTime, secondsLeft )
sceneGroup:insert(clockText)
end
– show()
function scene:show( event )
local sceneGroup = self.view
local phase = event.phase
if ( phase == “will” ) then
– Code here runs when the scene is still off screen (but is about to come on screen)
elseif ( phase == “did” ) then
– Code here runs when the scene is entirely on screen
end
end
– hide()
function scene:hide( event )
local sceneGroup = self.view
local phase = event.phase
if ( phase == “will” ) then
– Code here runs when the scene is on screen (but is about to go off screen)
elseif ( phase == “did” ) then
– Code here runs immediately after the scene goes entirely off screen
end
end
– destroy()
function scene:destroy( event )
local sceneGroup = self.view
– Code here runs prior to the removal of scene’s view
end
– Scene event function listeners
scene:addEventListener( “create”, scene )
scene:addEventListener( “show”, scene )
scene:addEventListener( “hide”, scene )
scene:addEventListener( “destroy”, scene )
return scene
------------------pouselvl6.lua-------------------
local composer = require( “composer” )
local scene = composer.newScene()
local widget = require( “widget” )
local bg, soundFile, playSF, backB, muIcon, muIconB, settings, reset
local SEIcon, SEIconB, msg
local background
–local function onImageTouch (self, event)
–if event.phase == “ended” then
–composer.gotoScene(“loading”, “fade”, 800)
–return true
–end
–end
function onEventListenerMenu(event)
composer.gotoScene(“minimap”, “fade”,800)
end
–RESTART–
function onEventListenerRestart(event)
composer.removeScene(“lvl6”);
composer.gotoScene(“lvl6”, “fade”,800)
end
–SETTINGS–
function onEventListenerSettings(event)
composer.gotoScene(“settingsrunning”, “fade”,800)
end
function onEventListener(event)
composer.gotoScene(“lvl6”, “fade”,800)
end
function scene:create( event )
local sceneGroup = self.view
background = display.newImage(“backgrounds/MENU.jpg”,480,270)
sceneGroup:insert(background)
local buttonPlay = widget.newButton({
with = 50,
height = 50,
defaultFile = “buttons/x.png”,
overFile = “buttons/xX.png”,
onEvent= onEventListener
})
buttonPlay.x = 900
buttonPlay.y = 125
sceneGroup:insert (buttonPlay)
local buttonMenu = widget.newButton({
with = 50,
height = 50,
defaultFile = “buttons/menu.png”,
overFile = “buttons/menu1.png”,
onEvent= onEventListenerMenu
})
buttonMenu.x = 480
buttonMenu.y = 250
sceneGroup:insert (buttonMenu)
local buttonRestart = widget.newButton({
with = 50,
height = 50,
defaultFile = “buttons/restart.png”,
overFile = “buttons/restart1.png”,
onEvent= onEventListenerRestart
})
buttonRestart.x = 300
buttonRestart.y = 250
sceneGroup:insert (buttonRestart)
local buttonSettings = widget.newButton({
with = 50,
height = 50,
defaultFile = “buttons/settingsLogo.png”,
overFile = “buttons/settingsLogo1.png”,
onEvent= onEventListenerSettings
})
buttonSettings.x = 660
buttonSettings.y = 250
sceneGroup:insert (buttonSettings)
–RESTART–
local myRestart = display.newText( “Restart”, 300, 350, “GROBOLD.ttf”, 40 )
myRestart:setFillColor(0,0,0)
sceneGroup:insert (myRestart)
local myMenu = display.newText( “Menu”, 480, 350, “GROBOLD.ttf”, 40 )
myMenu:setFillColor(0,0,0)
sceneGroup:insert (myMenu)
local mySettings = display.newText( “Settings”, 660, 350, “GROBOLD.ttf”, 40 )
mySettings:setFillColor(0,0,0)
sceneGroup:insert (mySettings)
–local btn = widget.newButton { label=“CLICK”}
–sceneGroup:insert(btn)
–btn:addEventListener (“tap”,changeScenes)
end
– show()
function scene:show( event )
local sceneGroup = self.view
local phase = event.phase
if ( phase == “will” ) then
– Code here runs when the scene is still off screen (but is about to come on screen)
elseif ( phase == “did” ) then
– Code here runs when the scene is entirely on screen
end
end
– hide()
function scene:hide( event )
local sceneGroup = self.view
local phase = event.phase
if ( phase == “will” ) then
– Code here runs when the scene is on screen (but is about to go off screen)
elseif ( phase == “did” ) then
– Code here runs immediately after the scene goes entirely off screen
end
end
– destroy()
function scene:destroy( event )
local sceneGroup = self.view
– Code here runs prior to the removal of scene’s view
end
– Scene event function listeners
scene:addEventListener( “create”, scene )
scene:addEventListener( “show”, scene )
scene:addEventListener( “hide”, scene )
scene:addEventListener( “destroy”, scene )
return scene