In the next method, a screen will be created and will display Game Over and the score that the player had reached.
1. Insert the method
CreateGameOverScreen
into thegame
class.Method CreateGameOverScreen:Int ()
2. Set the default layer to
layerGameOver
.eng.SetDefaultLayer(layerGameOver)
3. Create a blue box.
Local b := eng.CreateBox(cw/1.5,ch/4,cw/2,ch/2) b.SetColor(0,0,255)
4. Add a text object that will display the text
GAME OVER
.Local tx1 := eng.CreateText(font1,"**** GAME OVER ****",cw/2,ch/2-30,3)
5. To display the score, add another text object (txtFinalScore).
txtFinalScore = eng.CreateText(font1,"SCORE: 000000",cw/2,ch/2+30,3) Return 0 End