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

For this we will create another method inside the game class.

  1. Insert a new method called CreateTitleScreen.
    Method CreateTitleScreen:Int ()
    
  2. Load the title screen image into a local object and set its layer to layerTitle.
    Local ts:ftObject = eng.CreateImage("CR_TitleScreen.png",eng.canvasWidth/2, eng.canvasHeight/2)
    ts.SetLayer(layerTitle)
    
  3. Create a PLAY button at the location the button is drawn onto the image.
    CreateButton(eng.canvasWidth-220,60,eng.canvasWidth/2, eng.canvasHeight-260, btnPlay, layerTitle)
    
  4. Close the method:
    Return 0
    End
    

What just happened?

Continuing with our method to have several creator methods, we have one to assemble the title screen on its own layer. Since it is on its own layer, we ...

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