O'Reilly logo

Monkey Game Development by Michael Hartlef

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required