Time for action — adding a title screen

  1. Inside the game class, add a new method called CreateTitleScreen.
    Method CreateTitleScreen:Int ()
    
  2. Add a local text object for the game title. Its draw mode is set to CENTER (1), so fantomEngine will automatically draw the text centered around the given position parameters.
    Local txtTitle:ftObject = eng.CreateText(font1,"Comet Crusher",eng.canvasWidth/2,eng.canvasHeight/2-40,1)
    txtTitle.SetLayer(layerTitle)
    
  3. Now, add local text objects for instructions to start the game and show a high score list, which we will create later on.
    Local txtTitle2:ftObject = eng.CreateText(font1,"*** Press 'P' to play ***",eng.canvasWidth/2,eng.canvasHeight/2+10,1)
    txtTitle2.SetLayer(layerTitle)
    Local txtTitle3:ftObject = eng.CreateText(font1,"*** Press 'H' to see the high-score list ***",eng.canvasWidth/2,eng.canvasHeight/2+40,1)
    txtTitle3.SetLayer(layerTitle)
    
  4. Close the method.
    Return 0
    End
    

What just happened?

Again, this was another method that will set up a part of your game once you call it. This time it will create a simple title screen which is made of the logo, and two instructions for the player.

How good are you—the high score list

A game is not complete without some kind of high score list. That is why we will implement a high score list into the game.

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

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