The OnObjectTouch
method has the object itself as a parameter, and the touch ID that was given optionally when the TouchCheck
statement was called.
1. Inside the
OnObjectTouch
method, do aSELECT
on the object's tag value.Method OnObjectTouch:Int(obj:ftObject, touchId:Int) Select obj.GetTag()
2. Check against the constant
btnPlay
, that is, the Play button:Case g.btnPlay
3. Play the Select sound and start a new game:
g.sndSelect.Play() g.StartNewGame()
4. Check against the
btnBack
constant. This is the Back button:Case g.btnBack
5. Play the Select sound, activate the title layer, and set the game mode to
gmMenu:
g.sndSelect.Play() g.layerTitle.SetActive(True) g.gameMode = g.gmMenu
6. Check against the
btnExit
constant. This is the Exit button:Case g.btnExit
7. End the game with a call to the
Error
method, with an empty string:Error("")
8. Close the
SELECT
statement:End Return 0 End