Set the volume of a collision sound, based on the force of collision? [SOLVED]
this is a tough one...
I'm creating a physics game which you must lower the golden block to the base of a tower. I didn't add any sounds up to this point, but I recently added sound effects to my clickable squares so they make a hitting sound when the collide with one another. Here are a few screenshots of what I'm describing:
I decided to add some sound to these colorful clickable squares. By adding some rules to them:
As you can see I added my own variation for the time being by having the rules when it collides, has a combined speed (motion.x+motion.y) less than -200 (because they are falling), and self.already playing sound is false.... it will proceed to play the sound.
I'm wanting to know what goes in the red VOLUME equation I outlined.
I tried a few but the failed, but here are a few things to take into consideration:
1. Volume can only range from 0-1
2. It would make sense to have self.motion.x and self.motion.y in the equation... although self.motion.x can be taken out because it is a downward scrolling game.
3. self.motion.y will always be negative. Again, downward scrolling game. This negative makes it harder to convert the speed to the 0-1 range.
Leave a comment if you would like more info on what is going on.
If you can figure it out you have some God-like math skills!
All replies are appreciated! Thanks!