Page 1 of 1

[Solved] How do I make a sound play only once?

PostPosted: Thu Oct 20, 2011 6:47 pm
by bologna
I want a jump sound to play when the player sprite jumps, but when I tried to set that up the sound ended up playing on loop the entire time it was in the air.

While I have gotten it to Sort of work (the sound doesn't play when jumping multiple times with little time in between), there must be a better way.
Here's what I have right now.


Thanks for any help. bologna2011-10-20 20:09:46

Re: [Solved] How do I make a sound play only once?

PostPosted: Thu Oct 20, 2011 7:13 pm
by Ashley
Add a 'trigger once' condition. The event sheet is read once every tick (~60 times a second) so if you use a condition like 'is jumping', it is checked and true constantly, 60 times a second. If you put a play sound action in an event like that, it will play 60 sounds a second, which will sound pretty awful.

Adding a 'trigger once' condition beneath it turns it in to a trigger.

Re: [Solved] How do I make a sound play only once?

PostPosted: Thu Oct 20, 2011 8:11 pm
by bologna
Ah, thank you Ashley! Works perfectly.
Cheers

How do I make a sound play only once from variable?

PostPosted: Fri Mar 02, 2018 3:23 pm
by Piggy321
All good evening, I'm making a game, and I need to reproduce the sound from the change only once, but the trigger just does not help, since it turns off the repetition of actions with the variable, what should I do? (Sorry for my broken English, I did not learn this language)

Re: How do I make a sound play only once from variable?

PostPosted: Fri Mar 02, 2018 3:34 pm
by zenox98
Piggy321 wrote:All good evening, I'm making a game, and I need to reproduce the sound from the change only once, but the trigger just does not help, since it turns off the repetition of actions with the variable, what should I do? (Sorry for my broken English, I did not learn this language)


Please do not multi-post the same query. You have already asked this here - https://www.scirra.com/forum/viewtopic.php?f=147&t=201276 - no need to resurrect a thread that is over 6 years old.