2
$\begingroup$

I'm setting up an audio book of sorts in BGE. I'm wanting to be able to click on a button to play a sound until the end, unless I click on a different button before the sound ends. If i click on the second button I want the first button to stop making it's sound.

If i set the sound actuator to Play Stop then i have to hold the button down to listen to it all. Then if I set the sound actuator to Play End and click on different buttons, then all the sounds play over each other.

I would prefer to be able to do this with just using the logic bricks, but do i have to use a python text to get it to do what i want?

$\endgroup$
2
$\begingroup$

It's simple: use properties.

When you click, you set the property "sound" to then respective number of sound. Then, you check the property value with "Property" sensors and play sound 1 if property = 1, play sound 2 if property = 2 and so on.

Here's a working example file:

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.