Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

6. Game #5, Balls Out! > Time for action — enhancing the OnObjectTouch method

Time for action — enhancing the OnObjectTouch method

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 a SELECT 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
    

  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint