The next method will set up the two text objects for us:
1. Inside the
game
class, add a new method calledCreateInfoText
.Method CreateInfoText:Int ()
2. Create the
txtScore
text object from thefont1
font object. Set it to the background layer.txtScore = eng.CreateText(font1,"Score: "+score,40,46) txtScore.SetLayer(layerBackGround)
3. Repeat this with the
txtFPS
text object.txtFPS = eng.CreateText(font1,"FPS: "+999, eng.canvasWidth-45,46,2) txtFPS.SetLayer(layerBackGround)
4. Close the method.
Return 0 End
To display some info text values, we have created two text objects with the CreateText
method of fantomEngine. Later in the game, we will update them with the SetText
method of each object.