Didn't expect that one now did ya?
The art of farting sounds
Farting sounds were fun to implement in Crumble because it just takes you by surprise and I'm a huge fan of trying to make the environment react to the player.
So having good sounds for it is important and cycling through a list of them is better than just a regular unique farting noise.
This is a simple function to call when you want to play a sound on an audiosource. You can notice that I change the pitch of it to play variation of the audioclip based on the scale of the mushroom. The larger it is the lower the pitch.
I also add a little offset just to add a little variation just in case. And everything is clamped between reasonable pitch values.
This is what the result sounds like:
Also on a side note i've been reading multiple tips devlog here https://johnleonardfrench.com/articles/10-unity-audio-tips-that-you-wont-find-in-the-tutorials/
And it's actually really useful informations, so if you're interested in audio inside unity give it a read.
Scaling the shrooms
For scaling the mushrooms and getting this nice dynamic effect of being pressed and regrowing with time I simply used a scale multiplier in script!
I'm getting the distance from the mushroom to the player in update and triggering the function based on that, It's way cheaper to do it this way than with triggers and actual rigidbodies that will collide with the player (Although it would look cooler).
The scaling of the mushroom is based on this too + delta time!
And this to grow it back up depending on t time.
Also make sure the pivot on your shroom mesh is at the base of the mesh like so:
There is nothing much to add to it, it's just farting mushrooms.
If you want to experience farting mushrooms yourselves, wishlist Crumble on Steam