Wednesday, May 31, 2017

Roll Ball Unity 5.6 Part 7 - Restart & Exit Game - Final Part

Part 6 bisa dilihat disini...
Di part 7 pengen pake bahasa English biar sekalian latian ehehe, jdi tar pas divideoin udh tau apa yang mau diomongin... B-)

Ok.......
In this part we'll gonna add menu when player win the game. This menu will be shown up after player has hit at least 13 balls.
So... First, let's add a button, hit Gameobject menu then choose UI, then button as shown in the picture below :
Choose 2D view, and adjust our view for button like this...

Then drag button to top right..

Aaaand.... Rename button to "Play Again"...
Duplicate above button and then give a name to "Exit"

Neext... rename canvas to "Win Menu" and button to restart and exit button...
Okie... It's time to play with script, let's open SphereController.cs. In that script we'll gonna hide WinMenu and show it again when user has hit at leat 13 balls. So add this line code below...
If you don't really understand above code, please leave a comment... :)
Track change on github can be seen here....

Neext... Let's add listener for those two buttons, so when hitting "Play Again", the game will be restarted and when hitting "Exit", game will exit.... those two listeners will be added also on SphereController.cs as shown below
Okiee.... That's all for this part.... Here's the demo..

No comments:

Post a Comment