Muting audio by releasing keys

0 favourites
  • 3 posts
From the Asset Store
Random Maze Generator with Door & Key System - tutorial capx
  • 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.

    Simple.

    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 :

    soerenator.blogspot.dk/2013/02/blog-post.html

    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="http://gyazo.com/50bd51354de55fd201050ddc93f7c36d.png" border="0" />

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