To create text buttons, we will reuse some code that we have created in a previous chapter.
Copy the CreateTextButton
method from Chapter 4, Game #3, CometCrusher, into the game
class.
Method CreateTextButton:ftObject (font:ftFont, txt:String, xp:Int, yp:Int, id:Int, layer:ftLayer) Local but:ftObject = eng.CreateText(font,txt,xp,yp,1) but.SetTag(id) but.SetTouchMode(2) but.SetLayer(layer) Return but End
Reusing code is a good thing. Why reinvent the wheel several times. That is why we use the fantomEngine framework in the first place, isn't it?
18.218.171.212