Audio Control

0 favourites
  • 3 posts
From the Asset Store
100+ Musical High Quality Sound Effects for your game!
  • I have a button that's a picture of a speaker named "Sound". When someone clicks it, it will turn to the animation version of the speaker with a red circle and line through it over it and all game sounds should become muted.

    If someone clicks it again, the speaker image should return to normal and the sounds of the game should become audible again but somehow my code is not working.

    Button animations are:

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

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

    and the code is currently:

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

    Can anyone tell me why this isn't working or provide links to a helpful tutorial on the subject?


  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Both events are triggering in the same tick, so they're cancelling each other out. It's a long way round, but I'd suggest the following method:

    Give your sound object an instance boolen "OnOff" or whatever.

    Use a single On touched event that toggles the boolean state.

    Then create two more events, one that tests if "OnOff" is true, the other tests if its not (inverted condition). Set your audio silence and animation states accordingly.

  • Yes that did the trick. I assigned boolean value "OnOff" to my sound button and then coded it in as you said. Here is the code if anyone wants to see:

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

    Thanks GeometriX

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