How do I play sound on several Lava Jets?

0 favourites
  • 5 posts
From the Asset Store
Tileset for action or adventure platformer games with underground, cave, lava, mine, and or similar themes.
  • Hi everyone,

    In my game, the Player has to pass between Jets (water, lava, etc...).

    I would like to add a sound when the closest jet from the Player is visible.

    I tried Play at object and I have my Player has listener, but it does not work.

    Maybe it's not the right way to address alternated sound? If you have any hints.

    Thanks

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • couple things..

    first Trigger Once won't work on loops like that.

    second, are you using Visible as "visible on the screen"? because all objects are visible until you make them not visible. You probably want to use Is On Screen instead.

    third, Play At Object is bugged and produces a weird static sometimes so I suggest using Play and set the volume dB depending on how far away the player is with: -(distance(Magma.X,Magma.Y,Player.X,Player.Y) / 50)

    also I would suggest running all your magma sounds through one tag "Magma" and then On Start of Layout add a Compressor effect to "Magma" (use default settings is fine) this way they will never clip, like if you were close to a lot of them at once.

    Also think about adding a small pitch variance after each one: tag: "" Playback rate: random(0.98,1.03) this range might be to be widened depending on the sound.

    also make sure you use "" for tag and not your actual tag name since this will only change the last played sound and not all sounds for "Magma"

  • jobel

    wooo thank you so much for your kind hints.

    I followed what you suggested and it works well, thank you.

    I was wondering, if the sound is looping, how can I stop the furthest "Magma" without stopping all the others?

  • To do this you won't be able to channel all your sounds into one tag for compression. Because you'd want to make a unique tag for each sound, so just add the UID to the tag like this:

    Play Magma Tag: "MagmaSound" & Magma.UID

    Then when you want to stop it

    Pick Furthest Magma

    Stop "MagmaSound" & Magma.UID

  • Omg. Thank you so much.

    I won't be able to find it alone.

    Sincerly thank you.

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