Our title screen is composed of a single colored red rectangle and three text objects. One is for the title itself, and two are instructions about which keys the player has to press to start a new game or exit it.
CreateTitleScreen
, inside the game class.Method CreateTitleScreen:Int ()
Before version 1.30 of fantomEngine, you needed to assign each new object to a layer. Now, you can set a default layer and every new object will be automatically assigned to it.
eng.SetDefaultLayer(layerTitle)
Local box:ftObject = eng.CreateBox(eng.canvasWidth,eng.canvasHeight,eng.canvasWidth/2,eng.canvasHeight/2)
box.SetColor(255,0,0)
At The Docks
will be made from a text object. Scale it up to a factor of 2.0.Local tx1:ftObject = eng.CreateText(font1,"At the docks",eng.canvasWidth/2,eng.canvasHeight/4,1) tx1.SetScale(2.0)
Local tx2:ftObject = eng.CreateText(font1,"Press 'A' to play", eng.canvasWidth/2,eng.canvasHeight/2+40,1)
Local tx3:ftObject = eng.CreateText(font1,"Press 'Y' to exit", eng.canvasWidth/2,eng.canvasHeight/2+150,1) Return 0 End