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

Get help using Construct 2

Post » Thu Oct 20, 2011 6:47 pm

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
B
2
S
1
G
2
Posts: 5
Reputation: 1,235

Post » Thu Oct 20, 2011 7:13 pm

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.
Scirra Founder
B
415
S
248
G
92
Posts: 25,291
Reputation: 200,966

Post » Thu Oct 20, 2011 8:11 pm

Ah, thank you Ashley! Works perfectly.
Cheers
B
2
S
1
G
2
Posts: 5
Reputation: 1,235

Post » Fri Mar 02, 2018 3:23 pm

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)
B
1
Posts: 3
Reputation: 131

Post » Fri Mar 02, 2018 3:34 pm

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.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
147
S
33
G
89
Posts: 5,992
Reputation: 62,799


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 15 guests