Sounds volume relative to distance

0 favourites
  • 6 posts
From the Asset Store
Add epicness and fantasy to your games with these 20 themes (divided in 83 tracks for interactive music)
  • Hey all !

    I'm trying to make a sound volume relative to the distance between the source and the listener, I can't find informations about that, at the moment the manual is broken and some precious topic are missing !

    So, I'm on a big layout, I want the player to hear sound volume based on how far he's from the source, for example an ennemy firing 1000 pixels aways, the volume must be low and as I get closer from the source the volume is higher.

    Any ideas on this ?

    Thanks !

  • If you just want volume, set the volume to some multiple of the distance every tick (like 0.2*distance), but I assume you would want panning, too. In the audio section don't just play sound but choose the "play sound at position" option. Then you can set the epicenter, the rolloff, everything. It will also pan left/right relative to whatever you set. I typically do just the center of the screen, but you can do it relative to your player, for instance, if you want.

  • The PDF manual is here: https://www.scirra.com/manual.zip

    See if that still works.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • If you just want volume, set the volume to some multiple of the distance every tick (like 0.2*distance), but I assume you would want panning, too. In the audio section don't just play sound but choose the "play sound at position" option. Then you can set the epicenter, the rolloff, everything. It will also pan left/right relative to whatever you set. I typically do just the center of the screen, but you can do it relative to your player, for instance, if you want.

    Thanks for your answer, I tried the play sound at position, but I don't get it to work. The sound have the same volume, and there is no pan left/right. I'll try to make an example capx soon.

  • See the built-in positioned sounds example. You need to set a listener object for it to work.

  • I'm using a listener, the sound is well positionned... And I was missing the Audio Properties, thanks manual, I'm lost without you !

    Ty all !

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)