local composer = require ("composer")
local scene = composer.newScene()

local mainGroup

local tmr


local function closeCredits(event)
    if ( event.phase == "ended" ) then
        composer.gotoScene( "mainMenu", "crossFade", 1000 )
    end
    return true
end

function scene:create( event )
    local mainGroup = self.view

    local options = 
    {
        text = "\n \n \nbuke goksel \nfiliz durgun \nhande siri \nonur saka \nserkan aksit \nClinthammer - freesounds.org \nlevelclearer - freesounds.org \n\nthanks to \ncamur the cat \nbrown the dog \nberfu the human \nsinan the weird \nalex the puppy",     
        x = 0,
        y = 0,
        width = display.contentWidth,
        height = display.contentHeight,
        font = native.systemFontBold,   
        fontSize = 40,
        align = "center"
    }

    local creditsText = display.newText( options )
    creditsText.x = display.contentCenterX
    creditsText.y = display.contentCenterY
    mainGroup:insert(creditsText)    
end

function scene:show( event )
    local phase = event.phase

    if ( phase == "will" ) then

    elseif ( phase == "did" ) then
        Runtime:addEventListener( "touch", closeCredits )
    end
end

function scene:hide( event )
    local phase = event.phase

    if ( phase == "will" ) then

    elseif ( phase == "did" ) then
        Runtime:removeEventListener( "touch", closeCredits )
    end
end

function scene:destroy( event )

end

-- Listener setup
scene:addEventListener( "create", scene )
scene:addEventListener( "show", scene )
scene:addEventListener( "hide", scene )
scene:addEventListener( "destroy", scene )

return scene