0 Favourites

How do I repeat a sound?

  • Posted this on the "How do I ..." forum but havent gotten any replies. Hope Im not breaking any rules by posting it here too.

    I'm having trouble getting an explosion sound to play from start to finish, pause for a second or two and then play thru again. Would like to do the same thing with the matching explosion animation. I can do it one anim+sound at a time with a button click, but I would like it to start and then repeat itself perhaps 2-4 times without player clicking a button. Any suggestions?

  • Could you not just copy/paste the explosion event and sound triggering event triggered once, twice with a 2 second wait between?

    If its a random 2-4 times you could nest them under a primary variable testing event that got a number and then filtered any remaining times with else condition...

    ie. something like:

    times=choose(0,1,2,3)

    play explosion event

    play sound event

    if choose = 0

    play explosion event

    play sound event

    else if choose = 1

    play explosion event

    play sound event

    wait 2

    play explosion event

    play sound event

    else if choose = 2

    play explosion event

    play sound event

    wait 2

    play explosion event

    play sound event

    wait 2

    play explosion event

    play sound event

    else if choose =3

    play explosion event

    play sound event

    wait 2

    play explosion event

    play sound event

    wait 2

    play explosion event

    play sound event

    wait 2

    play explosion event

    play sound event

    I am sure it could be written much more efficiently.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • You can put the [play explosion event] and the [play sound event] in a function and you repeat this function 4 times (with a delay).

  • Thank you, guys. Both work for me. Good learning experience.

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