Hey lornetw:
There are a couple things you can do in the program to get the kind of response you're looking for. To make the clash sound effect the priority, you will want to lock out all the other inputs once the clash input is triggered. To see how this is done you can look at the sample program at this link:
foxonix.com/learn/sample-programs/99-simple-sfx-trigger
In this sample program, you'll see that the button connected to pin P1.0 is interruptible. That is, it can be pressed repeatedly, and each time it is pressed it will interrupt the current audio and cause the sound effect to be played from the beginning. In this same program, you'll also see that the button connected to pin 1.1 is NOT interruptible. That is, when this button is pressed, the sound effect must play all the way through to the end before this button can be triggered again. This is accomplished by setting different input states; one input state is called "enabled" and the other input state is called "locked_out." When the button connected to P1.1 is pressed, the button2: label is called. The first this that happens in this program path is that the locked_out input state gets set. This means all of the buttons are ignored. Then the sound effect plays. After the sound effect is done playing, the enabled input state gets set so that all the buttons become active again.
You will want to do something similar in the lightsaber program. When the clash sensor is triggered, the clash: label is called. Right after this label, you can lock out all of the inputs to guarantee that the clash sound effect does not get interrupted. Then when the clash sound effect is done playing, you can re-enable the inputs. In the case of the lightsaber program, it looks like you would want to set the "active" input state after the clash sound effect.
To see if the swing sensor is still active, you can read the state of the input port, which is described here:
foxonix.com/learn/programming-reference/...-on-input-port-value
In the lightsaber program, you would read the state of the swing switch and if it's active you would jump to the swing: label. The code for that might looks something like this:
& P1?[0 0 1 0]:swing
Give this a try and let us know how it works.
- Will @ foxonix