0 Favourites

How do I make a sound repeat?

  • 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 a perhaps 2-4 times a few seconds after 'on end of layout' without player clicking a button.

  • I have a few question what is the logic in getting 2 ,3 or 4 times. is it random or is it based on condition of the result of your game.

    And right you you can do function such as on end of layout do function

    and then repeat (callback variable)

    do what you want to do.

    Or you can use Timer here

    on end of layout. choose 2,3,4 for a global variable

    Start timer

    and do during timer do the action

    When timer expire substract one

    if compare two value

    First value is global variable is equal 2nd value (0) end the game

    else start timer.

    This should work if it doesnt then i do not know how you are running your game.

  • 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 use the function object to help you with this. Create a function called "Explosion" which takes the number of explosions as a parameter.

    On Function "Explosion"

    For Loop, repeat Function.Param(0) times -> play explosion animation -> play explosion sound

    if Function.Param(0) > 1 -> wait 1 second

    When the player clicks:

    on click -> Call Function "Explosion" with one parameter =1

    This will play the explosion one time

    At the end of layout -> Call Function "Explosion" with one parameter= 10

    This will make 10 explosions (and so on).

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