In the menu screen we create, the game title will also be displayed at the top.
1. Insert a new method called
CreateMenuScreen
into thegame
class.Method CreateMenuScreen:Int()
2. Set the the default layer to
layerMenu
.eng.SetDefaultLayer(layerMenu)
3. Add a dark-gray-colored box that covers the whole canvas.
Local b := eng.CreateBox(cw,ch,cw/2,ch/2) b.SetColor(55,55,55)
4. Now, add a text object that will display the game title and scale it by a factor of
2
.Local t1 := eng.CreateText(font1, strTitle, cw/2, ch/2-100, 3) t1.SetScale(2.0)
5. Now, add three text buttons. We need the buttons
Play, Score
, andExit
.Local bt1 := CreateTextButton(font1, "Play", cw/2, (ch/9)*4, btnPlay, layerMenu) Local bt3 := CreateTextButton(font1, "Score", cw/2, (ch/9)*5, btnScore, layerMenu) Local bt6 := CreateTextButton(font1, "Exit", cw/2, (ch/9)*7, btnExit, layerMenu) Close of this method. Return 0 End