Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Thread Tools Display Modes
How do I play multiple sounds in a row?
Posts: n/a
Default How do I play multiple sounds in a row? - 05-09-2010, 09:10 AM

I am making an alice first person shooter and I have a rapid fire weapon. But when I make it play a sound it waits for the sound to finish before it can fire again. Is there any way to play sounds in rapid succesion on multiple clicks like in real fps's?

(I know that the change duration is broken, but how do I use the begining and ending sound functions?)
Reply With Quote
Super Moderator
x2495iiii's Avatar
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 05-09-2010, 01:16 PM

Here's what I do:

Insert seven number variables, six called shot1, shot2, and so on, and the seventh called index. Then, have your gun use index to increment one of the variables (if index = 1, increment shot1 and increment index, else if index = 2....else increment shot6, index set value to 1) Put this in the firing method of the gun so it's done each time the gun is shot. Then, insert six "When a variable changes" events that correspond to each of the variables. Finally, have a different object play the firing sound in each event.

Now, six variables is just what I used for my sound effect, but yours may be longer, so you may need more variables and events. The idea is to have a chain of variables long enough so that by the time it gets to the last one, the sound effect from the first shot is already done playing and the chain can start over.

Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Copyright ©2019, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.