Alternate audio sounds?

0 favourites
From the Asset Store
Make your gore effects come to life with this sounds! :D
  • You can't create patterns with choose() or random() though.

  • You can't create patterns with choose() or random() though.

    yeah, that's why I used your --- Set counter to counter % 3 + 1 idea

    although I changed it to 6 which makes more sense in my case... since I have bullet firing sounds, then every 6th event it changes the sound slightly.

    for patterns maybe a better idea would be to make a Function and somehow make it dynamic so that you could use it for multiple things.   Make sure all sound files are named the same except for the number.

    so pass the function: filename (minus the number), the number of sounds, then the pattern to play and the counter which tells us where we are in the pattern.

    i.e.

    Call Function ("PlaySoundPattern","gun", 2, "6:1", PlayerShootcounter)

    I'm new to Functions in C2 can anyone help here? how would you send a pattern information to a function so that it understands how to play them? patterns like 6:1 or 3:2 or 1:2:1 if there are 3 sounds etc..? how to make it dynamic?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you want a pattern, your best best will be to load the file names into an array (at the start of the layout or game, for instance) lie 0,1 = gun1, 0,2 = gun1, 0,3 = gun2 and so on. Then just play file at each of those locations, but add 1 to the y index each time. Then, if the y index surpasses your highest file name, set it back down to your lowest. It's actually how I do footsteps on my game, though I randomize baed on array values. Then I can change the file names out in the array depending on what surface you are walking on, but the command to play the footsteps keeps on going.

  • If you want a pattern, your best bet will be to load the file names into an array .

    ahh nice idea using arrays... so if I were to make it a Function I could pass the array bounds.

    say I had a 7 pattern of: 1 1 2 1 2 1 2

    CallFunction("PlaySoundPattern",PlayerShoot_arrraysounds, 7, PlayerShootCounter)

    CallFunction("PlaySoundPatter",BadGuy_arraysounds,3, BadyGuyShootCounter)

    although should probably make array bounds a constant so you can change it easy.

    C7, you must do this for footsteps on different materials..grass, woodfloor, cement floor etc...?

  • > If you want a pattern, your best bet will be to load the file names into an array .

    ahh nice idea using arrays... so if I were to make it a Function I could pass the array bounds.

    say I had a 7 pattern of: 1 1 2 1 2 1 2

    CallFunction("PlaySoundPattern",PlayerShoot_arrraysounds, 7, PlayerShootCounter)

    CallFunction("PlaySoundPatter",BadGuy_arraysounds,3, BadyGuyShootCounter)

    although should probably make array bounds a constant so you can change it easy.

    C7, you must do this for footsteps on different materials..grass, woodfloor, cement floor etc...?

    Right. I have a different set of footstep sounds for different things like grass, sand, cement, dirt, wood, etc.

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