Selasa, 07 Maret 2017

Background And Sound

This time we will add following features to our game:
  • Background picture
  • Background music that is continuously played.
  • Sound effect when shooting.
  • Sound effect when enemy is shot and disappear.

In Scratch, below is how the game will look like after the background picture is added.



For background music, in Scratch, we update the Game Manager to add following script.


For the shooting sound effect, in Scratch, we update the Ball sprite.


For enemy shot sound effect, in Scratch, we update the Enemy sprite.



In Unity we are going to do the same as above.

For shooting sound effect, we update the Ball sprite script.


For the enemy shot sound effect, we update the Enemy sprite script.


For background music that is continuously played, in Unity, we do not need script update. It is enough to add an Audio Source component to the Game Manager with the following setting.



Below video is the tutorial on how to add the background picture, background music, and sound effect in Unity using the above scripts.





Below is the comparison between Scratch and Unity.

Play Sound Effect 

In Scratch



In Unity






Assignment-5

Play the different sound effect when the enemy that is moving down (see assignment-1) is touched by the Ball sprite.










Tidak ada komentar:

Posting Komentar