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 — 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,"*** ...

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