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
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

7. Game #6, At The Docks > Time for action — creating a StartNewGame method

Time for action — creating a StartNewGame method

This method will deactivate the title layer, set the level number to 1, and load the level. To implement it, follow the ensuing steps:

  1. Insert the new method called StartNewGame into the game class.
    Method StartNewGame:Int()
    
  2. Deactivate the title layer.
    layerTitle.SetActive(False)
    
  3. Set the level number to 1 and load the level.
    levelNum = 1
    LoadLevel()
    
  4. The field gameMode needs to be set to gmPlay. Close this method.
    gameMode = gmPlay
    Return 0
    End
    

What just happened?

Our last helper method starts a new game. It set all corresponding fields and will load the first level map.


  

You are currently reading a PREVIEW of this book.

                                                                                        

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

  

Start a Free Trial


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