Muting audio by releasing keys

Get help using Construct 2

Post » Sun Feb 03, 2013 12:37 pm

I'm a beginner to C2, so I was playing around a little and decided to make a planet rotation game.

The basic idea is that you can rotate the planet left or right by pressing left or right on the keyboard.


The problem appeared when I added a sound file to the "game". I want the sound to play when I press a button and stop/mute when I release it. My problem is that which ever way I do it the sound will keep looping, even after the button is released. I want it to loop though, as long as the button's pressed, but stop when released.

I have tried a variety of settings, like adding a keyboard event on any key released, with the action Stop "Sound" and Set "Sound" Muted.
I have also tried letting the volume be turned down to -1000 db when the key is released, but still want work.
I have tried moving the keyboard event from the bottom of the event "pile" to the top.

What is wrong? I can't seem to figure it out.
This is how the project's event pile looks like at the moment :

I know that the sound only plays when the left key is pressed, but it should still stop when it's released :)

Thank you,
Posts: 1
Reputation: 252

Post » Sun Feb 03, 2013 2:04 pm

Have you tried 'When key is down, set (x) db - When any key released, set 0 db? Also, what browser are you using?

PS. det er godt at se nogle flere danskere lave spil :D
Posts: 55
Reputation: 585

Post » Sun Feb 03, 2013 2:17 pm

I managed to replicate exactly what you want, with ease!

Posts: 226
Reputation: 4,042

Return to How do I....?

Who is online

Users browsing this forum: newt, RoboFrosty and 25 guests