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 thegame
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, cw/2, ch/2, 3) Local t3 := eng.CreateText(font1, "Version "+strVersion, cw/2, ch/2+50, 3)
5. To switch the screen automatically to the menu screen, we need to start an object timer. It will be attached to the box object, with the...