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 — setting up the high score list

We can set up the high score as follows:

  1. Inside the game class, create a new method called CreateHighScoreList.
    Method CreateHighScoreList:Int ()
    
  2. The list has a title; guess which one? Create a text object for it that is set to the layerScore layer.
    Local txtTitleHightScore:ftObject = eng.CreateText(font1,"H I G H S C O R E S",eng.canvasWidth/2,70,1)
    txtTitleHightScore.SetLayer(layerScore)
    
  3. Now, start a FOR loop for 10 entries.
    For Local y:Int = 1 To 10
    
  4. Each score entry will have a number on the left, indicating the rank inside the list.
    Local txtScoreNum:ftObject = eng.CreateText(font1,"#"+y,eng.canvasWidth/4+50,80 + (eng.canvasHeight/20)*y)
    txtScoreNum.SetLayer(layerScore)
    
  5. Now, create a new text object ...

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