Time for action — showing the high-score list

For this, you need to add a method that will update the list and then show the layer.

  1. Insert the method ShowScore into the game class.
    Method ShowScore:Int()
    
  2. To load the high-score list, make a call to fantomEngine's LoadHighScore method.
    LoadHighScore()
    
  3. Start a FOR loop ranging from 1 to the count of score list entries.
    For Local y:Int = 1 To eng.scoreList.Count()
    
  4. Set the text for each index in the high-score text object array with the value of the high-score list entry. Then, close the FOR loop.
    txtHighScore[y-1].SetText(eng.scoreList.GetValue(y))
    Next
    
  5. Set the game mode to gmScore and activate layers with it using our ActiveLayer method. After this, close the method.
    gameMode = gmScore
    ActivateLayer(gameMode)
    Return 0
    End
    

What just happened?

Within the method that you just added, you loaded the high-score list from the game state, filled the value of the list entries into the corresponding text area object, and activated the actual score layer. Later, when you show the high-score list, it will look like the following:

What just happened?
..................Content has been hidden....................

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