Muting audio by releasing keys

0 favourites
  • 3 posts
From the Asset Store
Piano Keys
$3.99 USD
A musical typing game where the goal is to play a song by pressing the matching keys as fast as you can!
  • 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,

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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

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

    <img src="" border="0" />

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)