Playing Sound at Every Instance of an Object

0 favourites
  • 5 posts
From the Asset Store
In this template the music plays without looping in your game
  • Hi everyone!

    Been playing around with positional sound lately and have a small problem.

    I want to play a positioned sound at an enemy object. As the enemy draws near, the sound grows louder, and as the enemy disappears into the distance, the sound fades too. This is pretty straightforwad to do with the "Play audio at object" action.

    The problem is, it plays the sound only at the first instance of the enemy object. For example, if I have four enemies on the layout, only the first one makes the sound and the other three are silent.

    Is this at all doable with the "Play audio at object" or do I have to do this some other way? I can't find anything in the manual about this and there doesn't seem to be any tutorials concerning positional audio.

    If anyone could nudge me in the right direction, I'd be grateful. Thanks!

  • How do you currently let them make sounds ?

  • How do you currently let them make sounds ?

    On start of layout -> Play (Enemy sound) looping at object (Enemy)

    Works perfectly if you only have one instance of Enemy, but I can't figure out how to extend this to other instances of the same object.

  • Here is a capX that works nicely.

    https://drive.google.com/open?id=0B1SSu ... ThyM0JFb0k

    It will not work in an 'on start of layout' if you created the objects in it & tried to pick them also there also .. in the 'for each loop'. But that has nothing to do with the audio plugin. You just cant pick newly created objects before the next top-level event.

    It wil not work if your sounds are in the 'music folder'. See browsers limitations in the manual.

    https://www.scirra.com/manual/109/audio

    I used a timer to hear the sounds individual and to stop/start them in one event. The wait action is not a good option. For the same reason i gave them tags.

    Click an object to start/stop an engine. Press numpad 0 - 3 to choose a 'car' to be able to steer it.

    Hope this helped you some.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This was extremely helpful, thanks yet again!

    I realized my mistake was omitting the "For each" condition. With your example I got it to work flawlessly.

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