How reset my scene?

I have my tab button, and when i press there my scene stay the same, don’t restart

physics = require( “physics” )

physics.start()

physics.setGravity(0, 0) – x , y

local composer = require( “composer” )

local scene = composer.newScene()

function scene:create( event )

local sceneGroup = self.view

– Called when the scene’s view does not exist.

– 

– INSERT code here to initialize the scene

– Limites do ecrã

local borderTop = display.newRect( 0, 0, 1000, 1 )

borderTop:setFillColor( 0, 0, 0, 0) – make invisible

physics.addBody( borderTop, “static”, borderBodyElement )

local borderBottom = display.newRect( 0, 707, 1000, 1 )

borderBottom:setFillColor( 0, 0, 0, 0) – make invisible

physics.addBody( borderBottom, “static”, borderBodyElement )

local borderLeft = display.newRect( 0, 1, 1, 707 )

borderLeft:setFillColor( 0, 0, 0, 0) – make invisible

physics.addBody( borderLeft, “static”, borderBodyElement )

local borderRight = display.newRect( 1000, 1, 1, 707 )

borderRight:setFillColor( 0, 0, 0, 0) – make invisible

physics.addBody( borderRight, “static”, borderBodyElement )

end


------------Meio Campo-------------


–CirculoVermelhoDireita

local myCircle = display.newCircle(40, 40, 30)

local trailprops = {x= 20, y = 20,r = 5} – r= tamanho do circulo do rasto, x e y é para centrar o rasto no meio

physics.addBody (myCircle, “dynamic”, {density=1.0, friction=0.5, bounce=0.0 } )

myCircle:setFillColor ( 255, 0, 0)

myCircle.x = 580

myCircle.y = 435

–Mover circuloVermelho

function myCircle:touch ( event )

if event.phase == “began” then

self.markX = self.x

self.markY = self.y

elseif event.phase == “moved” then

local x = (event.x - event.xStart) + self.markX

local y = (event.y - event.yStart) + self.markY

self.x, self.y = x, y

end

return true

end

myCircle:addEventListener( “touch”, myCircle)

function redraw () – Desenha o rasto

    Trail = display.newCircle( myCircle.x + trailprops.x, myCircle.y + trailprops.y, trailprops.r)

   Trail:setFillColor (255, 0, 0)

      

    myCircle:toFront( )

    print("!")

end

Runtime:addEventListener( “enterFrame”, redraw )

function scene:show( event )

local sceneGroup = self.view

local phase = event.phase

if phase == “will” then

– Called when the scene is still off screen and is about to move on screen

elseif phase == “did” then

– Called when the scene is now on screen

– 

– INSERT code here to make the scene come alive

end

end

function scene:hide( event )

local sceneGroup = self.view

local phase = event.phase

if event.phase == “will” then

– Called when the scene is on screen and is about to move off screen

– INSERT code here to pause the scene

– e.g. stop timers, stop animation, unload sounds, etc.)

elseif phase == “did” then

– Called when the scene is now off screen

end

end

function scene:destroy( event )

local sceneGroup = self.view

composer.removeScene( “view1”, true )

– Called prior to the removal of scene’s “view” (sceneGroup)

– 

– INSERT code here to cleanup the scene

– e.g. remove display objects, remove touch listeners, save state, etc.

end


– Listener setup

scene:addEventListener( “create”, scene )

scene:addEventListener( “show”, scene )

scene:addEventListener( “hide”, scene )

scene:addEventListener( “destroy”, scene )


return scene

While this tutorial is using Storyboard (Composer’s older brother):   http://coronalabs.com/blog/2013/08/20/tutorial-reloading-storyboard-scenes/

The techniques still apply to reseting your scenes using Composer. 

Rob

While this tutorial is using Storyboard (Composer’s older brother):   http://coronalabs.com/blog/2013/08/20/tutorial-reloading-storyboard-scenes/

The techniques still apply to reseting your scenes using Composer. 

Rob