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 — creating the title screen

Inside the next method, we will set up the title screen. A colored box, a few text objects, and a timer that will switch the screen automatically to the menu screen, are all we need.

  1. Add the method CreateTitleScreen to the game class.
    Method CreateTitleScreen:Int()
    
  2. Set the default layer to layerTitle.
    eng.SetDefaultLayer(layerTitle)
    
  3. Create a dark gray box that is the size of the canvas.
    Local box := eng.CreateBox(cw,ch,cw/2,ch/2)
    box.SetColor(55,55,55)
    
  4. Add text objects to display the title of the game, its author, and the version number. The title will be scaled by a factor of 2.0.
    Local t1 := eng.CreateText(font1, strTitle, cw/2, ch/2-100, 3) t1.SetScale(2.0) Local t2 := eng.CreateText(font1, "by "+strAuthor, ...

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