Simple way to loop sound effect X number of times?

0 favourites
  • 5 posts
From the Asset Store
An educational game for Times Table. An easy to use template for developers to build larger games
  • Hi guys

    Just wondering whether I'm missing a simple way of looping a sound effect, let's say 3 times.

    As far as a I can tell, the only way to do this is either use a counter and play the sound again once the it's finished, or turn looping off after X seconds.

    Turning looping off after X seconds is an OK option, I'm however using a 'sfx' tag already for my volume control, and can't seem to use multiple tags - in order to turn looping off for that particular sound.

    Any ideas?

    Thank you heaps in advance!

  • Add a global variable that counts the loop.(sfxLoopCount)

    Have a condition that

    If sfxLoopCount < 3

    AND

    (AUDIO)Is tag "sfx" NOT Playing

    -> play audio "abc" (tag "sfx")

    -> Add 1 to sfxLoopCount

    Cheers

  • Hi Maverick1912

    Thank you for the suggestion, it however still leaves me with the clashing problem.

    Since I have all my sound effects tagged as 'sfx', it means that the pseudo code in your suggestion would trigger any sound effect tagged 'sfx', and not just the Siren sound.

    I feel like there must be a simple way to do this - maybe editing the file and looping it 3x in Audacity would be the best solution.

    I would however like to know, whether there is a way to solve this while still being able to use my 'sfx' tag, for muting sound effects.

    Thanks again!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • So this is a special SFX, can you change it to another tag? Like "sfx_X1".

  • Hi Maverick1912

    I've used the method that you suggested, and made sure that when pausing sound effects, I mute the normal sounds as well as the special sounds. This seems like the best way to handle this.

    Thanks again :)

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