queue sounds.

Get help using Construct 2

Post » Thu Aug 08, 2013 7:26 pm

In the game are several voice overs, and I need to make sure they don't overlap as it sounds terrible, but also make sure that each is played.

Now, if say sound 1 is playing, and I want to play sound 2, I need something like:

If (sound 1 still playing) {
create new event:
     Audio on "1" ended: Audio play sound 2.
}

or similar.

The problem I see with this approach (even if creating events dynamically were possible), is that there is a window of opportunity for the sound 1 to end before the "on 1 ended" is registered or active, which means sound 2 will never get played.

So perhaps we need a sound queue plugin, which will maintain a First in First out queue of voice overs to play in sequence, at the same time and independent of a other sound effects playing.

Its logic would be more like:

Every tick: (if no sound with tag "voiceOver" playing) {
pop next sound item off queue.
If item found, play item.
}

C2 has no Queue structure, and an array would be less than ideal.

any ideas? This must be a common issue.
B
17
S
6
G
3
Posts: 370
Reputation: 3,942

Post » Thu Aug 08, 2013 7:59 pm

Actually the Array object has Push and Pop commands, so it can simulate a queue. You can look at rexrainbow's Timeline plugin. I vaguely recall people using it for sound sequencing.
ImageImageImage
B
71
S
20
G
202
Posts: 3,578
Reputation: 114,450


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 9 guests