Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Game #5, Balls Out! Time for action creating a StartNewGame method To start a new game, we will create a new method in the game class. Follow the given steps: 1. 2. 3. 4. 5. 6. 7. Add a new method called StartNewGame . Method StartNewGame:Int() Seed the random number generator with the current millisecond value: Seed = Millisecs() Reset the Score value to 0, as shown in the following code: Score = 0 Deactivate the title layer: layerTitle.SetActive(False) Remove all objects from the game layer: layerGame.RemoveAllObjects() Create a new ball: CreateBall() Create a new set of tiles: CreateTiles()