Sound



For the Prototype one thing the game lacked was sound. I already had the different sounds I wanted to include but was unsure of how to implement them. I firstly wanted to have sound for jumping, losing health & gaining a diamond. For the Jumping I used the Movement code to make it play the jump sound each time the play pressed space. I first got a Public Audiclip so I can add an Audio source to it in the inspector. Then each time the player jumps it will play the jump sound.  

I did something similar for the collect and die audio. For the collect sound, I created a new script and used OnTriggerEnter to detect collision with any foreign object. if the collision was detected it will play the audio collect. I used the same script for the Die and used the same principles to make it work.


For the button sound click and select sound effect.  I created an empty object in the hierarchy and added the audio source button click to it.

Than in the button onClick() i added it to play the audio when the button is clicked. When the button is hovered over by the mouse. I used the Event Trigger to check when the pointer enter the button area it will be play the audio. 

Lastly for the saws and gameplay audio I used the same method I used for the Prototype to just make it play on awake. 

Get Sully

Leave a comment

Log in with itch.io to leave a comment.