As we have several buttons in the game, we will add a method to the game class that will set up a button for us:
CreateButton
method into the game
class. Its parameters are the button width and height, its position, layer and an ID.Method CreateButton:Int (width:Int, height:Int, xp:Int, yp:Int, id:Int, layer:ftLayer)
CreateZoneBox
statement.Local but:ftObject = eng.CreateZoneBox(width, height, xp, yp)
OnObjTouch
event of the engine, we will set the tag property of the object with the ID.but.SetTag(id)
but.SetTouchMode(2)
but.SetLayer(layer) Return 0 End
Since we need to create several buttons in the game, we have created a method that will set them up for us. Later on, we can use the TouchCheck
method to determine if a button was hit.
3.129.216.7