forked from tutsplus/Corona-PlaneFightingGamePart4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gameover.lua
executable file
·47 lines (39 loc) · 1.46 KB
/
gameover.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
local storyboard = require( "storyboard" )
local scene = storyboard.newScene()local gameOverText
local newGameButtonfunction scene:createScene( event )
local group = self.view
local background = display.newRect( 0, 0, display.contentWidth, display.contentHeight)
background:setFillColor( 0,.39,.75)
group:insert(background)
gameOverText = display.newText( "Game Over", display.contentWidth/2,400, native.systemFont, 16 )
gameOverText:setFillColor( 1, 1, 0 )
gameOverText.anchorX = .5
gameOverText.anchorY = .5
group:insert(gameOverText)
newGameButton = display.newImage("newgamebutton.png",264,670)
group:insert(newGameButton)
newGameButton.isVisible = false
endfunction scene:enterScene( event )
local group = self.view
storyboard.removeScene("gamelevel" )
transition.scaleTo( gameOverText, { xScale=4.0, yScale=4.0, time=2000,onComplete=showButton} )
newGameButton:addEventListener("tap", startNewGame)
end function showButton()
gameOverText.isVisible = false
newGameButton.isVisible= true
end function scene:exitScene( event )
local group = self.view
newGameButton:removeEventListener("tap",startNewGame)
end
function startNewGame()
storyboard.gotoScene("gamelevel")
end
scene:addEventListener( "createScene", scene )
scene:addEventListener( "enterScene", scene )
scene:addEventListener( "exitScene", scene )return scene