Showing posts with label Games. Show all posts
Showing posts with label Games. Show all posts
Monday, June 12, 2017
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..
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..
Roll Ball Unity 5.6 Part 6 - Display Text, Play Fireworks & Sound
Part 5 bisa dilihat dilink ini...
Di part kelima ini kita akan nambain text dilayar yg isinya jumlah cube yg udah dihit dan text buat nandain klu udah menang... :)
So pertama-tama tambain empty_object buat nyimpent guitextnya. Terus ubah nama empty gameobjectnya jadi Display Text kek gini :
Terus buat empty gameobject lagi terus namain jadi hit Text kek gini :
Ters reset posisi Hit Text ke origin point :
Teruuus... tambain GUI Text ke Hit Textnya...
Teruuuss... nambain "Point: " di kolom Text dan ubah posisinya sesuai selera
Terus...... Hit Text-nya dijadiin child dari Display Text (drag and drop kek dipostingan sblmnya)..
Trs Hit Text diduplicate dan namanya diganti jadi Win Text kek gini :
Yang Win Text ini propertinya kyk gini :
Siiipsss... tampilannya udh siap...berikutnya adalaaah... scriptnya... so silahkan buka SphereController ters tambain ginian...
Untuk ngeliad perubahan yg lebih jelas, silahkan buka reponya di github disinih....
Eeeeh... ada yg luphaa..... lupa masukin fireworks pas menang... :v
Soo...tambain lagi kode dibagian showText() ahahaha.... kek gini ajjah...
Github commit...
mmmm....kekna gini ajjah... klu g' ngerti kodenya silahkan ditanyakan...ehehe... :D
Teruuuss... setelah fireworksnya udah ada...berikutnya adalah suaranya.... So mari kita buat 1 biji folder buat nyimpen suara...terus drag and drop file mp3 ke dalam foldernya kek gini :
Terus tambain 1 biji gameobject audio source dan masukin fireworks2 ke audio source ini
Siiipsss.... berikutnya trigger soundsnya pas udh menang pake script (tutorial buat ngejalanin suara bisa dilihat disini...) . So tambain kode ini...
Perubahan kode digthub bisa diliat disini.... Klu g' ngerti kodenya silahkan ditanyakan... :)
Siiipsss.... Gitu ajjah buat yg part 6.... :)
Demonya seperti ini....
Part 7 bisa dilihat disni.....
Di part kelima ini kita akan nambain text dilayar yg isinya jumlah cube yg udah dihit dan text buat nandain klu udah menang... :)
So pertama-tama tambain empty_object buat nyimpent guitextnya. Terus ubah nama empty gameobjectnya jadi Display Text kek gini :
Terus buat empty gameobject lagi terus namain jadi hit Text kek gini :
Ters reset posisi Hit Text ke origin point :
Teruuus... tambain GUI Text ke Hit Textnya...
Teruuuss... nambain "Point: " di kolom Text dan ubah posisinya sesuai selera
Terus...... Hit Text-nya dijadiin child dari Display Text (drag and drop kek dipostingan sblmnya)..
Trs Hit Text diduplicate dan namanya diganti jadi Win Text kek gini :
Yang Win Text ini propertinya kyk gini :
Siiipsss... tampilannya udh siap...berikutnya adalaaah... scriptnya... so silahkan buka SphereController ters tambain ginian...
Untuk ngeliad perubahan yg lebih jelas, silahkan buka reponya di github disinih....
Eeeeh... ada yg luphaa..... lupa masukin fireworks pas menang... :v
Soo...tambain lagi kode dibagian showText() ahahaha.... kek gini ajjah...
mmmm....kekna gini ajjah... klu g' ngerti kodenya silahkan ditanyakan...ehehe... :D
Teruuuss... setelah fireworksnya udah ada...berikutnya adalah suaranya.... So mari kita buat 1 biji folder buat nyimpen suara...terus drag and drop file mp3 ke dalam foldernya kek gini :
Terus tambain 1 biji gameobject audio source dan masukin fireworks2 ke audio source ini
Siiipsss.... berikutnya trigger soundsnya pas udh menang pake script (tutorial buat ngejalanin suara bisa dilihat disini...) . So tambain kode ini...
Perubahan kode digthub bisa diliat disini.... Klu g' ngerti kodenya silahkan ditanyakan... :)
Siiipsss.... Gitu ajjah buat yg part 6.... :)
Demonya seperti ini....
Part 7 bisa dilihat disni.....
Subscribe to:
Posts (Atom)