Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
We need to set up the game over screen and have it display the final score the player has achieved at the end of the round.
callGameOver().local callGameOver = function()
gameIsActive = false and pause the physics engine. Remove the panda and stars objects from the stage.gameIsActive = false physics.pause() panda:removeSelf() panda = nil stars:removeSelf() stars = nil
hudGroup group. Use the transition.to method to display the game over objects on screen. local shade = display.newRect( 0, 0, 480, 320 )
shade:setFillColor( 0, 0, 0, 255 )
shade.alpha = 0
gameOverDisplay = display.newImage( "gameOverScreen.png")
gameOverDisplay.x = 240; gameOverDisplay.y = 160
gameOverDisplay.alpha = 0
hudGroup:insert( shade )
hudGroup:insert( gameOverDisplay )
transition.to( shade, { time=200, alpha=0.65 } )
transition.to( gameOverDisplay, { time=500, alpha=1 } )