Hello Guest

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - Power_Michael

Pages: [1]
Help / Sound and Sound Attenuation
« on: May 23, 2017, 08:44:14 PM »
I am trying to implement sound that fades with distance in my game, so I have created a player who moves about a scene, and a boombox object that stays in one fixed location. I then defined the following in the boombox : entity class:
Code: [Select]
        Sound sound1 = new Sound("Sounds/salt.ogg", false);

        public Boombox(float x, float y) : base(x, y) {
            var image = Image.CreateRectangle(32, Color.Orange);

           // asf
            sound1.CenterSound(X, Y);
            sound1.RelativeToListener = false;
            sound1.Volume = 1;
            sound1.MinimumDistance = 0.5f;
            sound1.Attenuation = 2;

and then in my player I have this line of code inside of my Update() method:

Code: [Select]
Sound.CenterListener(X, Y);
When I run the game, the song plays, but it doesn't fade when the player is farther away.
---Do note that it (sound1) is a full length song, and it is an .ogg.

So how would I go about making this work? Or does this feature not work properly? Please help :D

https://www.pifsc.noaa.gov/hawaiian_monk_seal/img/myth8_med.jpg // a seal to be ironic


Pages: [1]