Location based sound

Discussion in 'Programming' started by Dusk Charmant, Sep 2, 2017.

  1. Dusk Charmant

    Dusk Charmant Member

    Dec 12, 2016
    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?

  2. dannyjenn

    dannyjenn Member

    Jul 29, 2017
    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: Sep 2, 2017

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice