Ok, as I build my game, I run across things like:
Hey, how would I do 'this'? or how would I do 'that'?
Well, it's actually incredible, nowadays I can solve some of my own problems, or even create cool things on my own!
For my game, I realized, it would be a drag if I had multiple players on the far end of a map generating PlaySound and another player on the polar opposite side hearing every single sound played.
I have this implemented in my game, but I decided to share the pieces of code in a separate project.
This made me realize, sound needs to be dimensional in a game like that.
I've made an example that calculates a distance vector from A Playing Sprite and Hearing Sprite.
The farther the hearing sprite is from the listening sprite, the lesser the sound. There's an added Sprite class called SoundSprite, which has required methods for a sound playing sprite.
Add support for Sounds, not just Music
Fix Up FMODBase code that I butchered to get this to work.
Remove the below requirements
Generate this into a Template.
Add a rule to turn Music ON and OFF from the player sprite.
Sound Barriers. A sprite generated from the sound sprite cannot find a route to the player because there's a barrier returns a low volume for that frame
The Hearing Sprite HAS to be Initialized before the Sound Can Play. This is linked with Counters, but it can easily be linked with a Map Plan and sprite parameters.
Sounds and some methods have to be manually typed in some dropdown boxes. This is because some objects do not use or return Integers.
If you DO choose to import this into a project, you must also re-import the FmodBase cs file.
In the meantime, the counter can be used to switch the sound sprites on and off.
Try, any kind of feedback if constructivehttp://paradigm.heliohost.org/src/dim_sound/