The next method will set up the two text objects for us:
game
class, add a new method called CreateInfoText
.Method CreateInfoText:Int ()
txtScore
text object from the font1
font object. Set it to the background layer.txtScore = eng.CreateText(font1,"Score: "+score,40,46) txtScore.SetLayer(layerBackGround)
txtFPS
text object.txtFPS = eng.CreateText(font1,"FPS: "+999, eng.canvasWidth-45,46,2) txtFPS.SetLayer(layerBackGround)
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.
18.116.118.229