How do I make the sound off but the music is on?

0 favourites
  • 7 posts
From the Asset Store
6 looping tracks to use in your games and projects. These tracks are in the style of the 1960s detective movie genre.
  • Is it possible that the sound effects are in silent but the background music is on?

  • Do you mean when the user presses a button? E.g. They can mute the sounds and music separately?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • yes... do you know how to do that?

  • Since music and sounds are separate, what I do is have a variable for playSounds and one for playMusic. On any event that plays sounds or music I add a condition that checks if the playSounds is true, same thing for playMusic. To shut them off, I have a button in my pause menu that lets them set it on or off. It's just a sprite with words in it for On and Off. It has 2 animation frames, one has the word "On" and one has the word "Off". When playSounds is true it is set to frame 1 so it shows "On". When it is false I set it to frame 2 which is "Off". Also I have an even that when the button is clicked and playSounds is set to false the stop all sounds event triggers. I do the same thing for music.

    If you start music in your start of layout events, just add a sub event to it for playMusic = True. That way if music is off, the music won't play at the start of layout.

    You may also want to make sure you save the game when they change this if you want it to remember their settings the next time they play.

  • Another way of doing this if you want to toggle sound and music both:

    Personally, I would use a variable to do this. I'm not sure how you have everything organized, but I would create a global variable system that works sort of like this (let's say your variable is called "soundtoggle"- I'll explain how to code it in a minute). First, however, assume the following is what you want.

    When soundtoggle = 0, all sounds are on.

    When soundtoggle = 1, the game sounds are off.

    When soundtoggle = 2, the music is off.

    When soundtoggle = 3, both the game sounds and music are off.

    Then add in logic to your event sheets that will only enable the game sounds to play if soundtoggle = 0 or 2, and only enabling music to play if soundtoggle = 0 or 1. Then (using buttons, keys, or however you want it- I'll assume you want to use keys- "m" to toggle music on and off and "s" to toggle sound on and off- for now but buttons should work similarly, I am just not that familiar with them) make an event sheet to do this (assume that "if" simply means there is a new event):

    if "m" pressed:

    -----if soundtoggle = 0 -------- soundtoggle = 2


    -----if soundtoggle = 1 --------soundtoggle = 3


    -----if soundtoggle = 2 --------soundtoggle = 0


    -----if soundtoggle = 3 --------soundtoggle = 1

    if "s" pressed

    -----if soundtoggle = 0 --------soundtoggle = 1


    -----if soundtoggle = 1 --------soundtoggle = 0


    -----if soundtoggle = 2 --------soundtoggle = 3


    -----if soundtoggle = 3 --------soundtoggle = 2

    Does this make sense?

  • I'm still understanding it.. Is there a way I can put the sound into a group and the music into a group so that when i press a button the sound group will disable

  • They are already in groups. Sounds and Music are two separate groups. However, if you turn them off, you also need to make sure that any place in your code that would normally start them checks to see if they are supposed to start. That is what the above examples do for you. Outside of that you may want to think about reading the manual and doing the tutorials. You will get much more out of working with them then by listening to us when you haven't worked much with them yet.

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