Time for action — creating the "game over" screen

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 the game 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
    

What just happened?

When this method is called later on, it will inform the player that the game has ended and show them the score they have attained.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.14.22.250