Time for action — creating text buttons

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

What just happened?

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?

The menu screen

Now that we have a method to create text buttons, we can define the menu screen.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.150.80