In this method, make use of the CreateAtomElements
method that we have built before:
1. In the
game
class, add a new method calledStartNewGame
.Method StartNewGame:Int()
2. First, set the game score to
0
.score = 0
3. Next, deactivate the title layer. Because of this, it won't be rendered and doesn't act on touch hits from the user.
layerTitle.SetActive(False)
4. Now, remove all objects from the game layer (if there are any).
layerGame.RemoveAllObjects()
5. Set the
collCount
field to0
. This will be used as an increasing ID for collision checks.collCount = 0
6. Finally, call the method that will create the grids of atom elements.
CreateAtomElements()
7. The last step is to set the game mode to
gmPlay
and close this method:gameMode = gmPlay Return 0 End