• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Location based sound

D

Dusk Charmant

Guest
Hi there. I'm fairly new to game maker, so please bare with me. Anyways, I have a fountain that animates, and I want to make a fountain sound when the player is near it and then get quieter the farther away the player walks away until you can't hear it eventually. How would I go about this, is there a GML function I could work with where I would place the sound object over the fountain?

Thanks
 
D

dannyjenn

Guest
There is a function called audio_sound_gain(index, volume, time) which allows you to set the sound's volume from 0 (no volume) to 1 (full volume). You will want to calculate the player's distance from the fountain and somehow scale it to a value between 0 and 1.

edit - There's also a function audio_play_sound_at() which you may want to look into. And there are also things called "audio emitters" which could be useful.
 
Last edited by a moderator:
Top