How do I disable sound effects after getting a Game Over?

0 favourites
  • 7 posts
From the Asset Store
Easily generate many levels from a set of pre-built scenes (Construct 3 template)
  • Hi,

    I'm making a simple shooting game and want to know how to stop a sound effect from playing after the player gets a Game Over. I've tried using the "Stop Audio" action but the "shooting" sound effect still plays when I click the mouse even after the Game Over text has displayed.

  • One of the tricks I use is that all music is played with the tag "background." All effects are played with the tag "effects." Whenever I need to stop one, I can audio.stop("effects").

    Are you using tags?

  • Hi Fengist,

    I'm using tags, but the audio effect still plays. I'm wondering if I need to include an event connected to clicking the Left mouse button as that's what triggers the sound but I'm not sure how to do this.

  • add a global variable GameOver = 0

    When the game is over set it to 1

    Then add another condition GameOver = 0 to sounds and anything else that should not trigger while Game is Over

    Or a more organized way add Event GameOver = 0 and then add all those others as sub-events of that

  • Hi Fengist,

    I'm using tags, but the audio effect still plays. I'm wondering if I need to include an event connected to clicking the Left mouse button as that's what triggers the sound but I'm not sure how to do this.

    In some way, whether it's through the variable Mario suggested or through a mouse click, you'll need some event that turns it off. And once you do, make sure there's nothing else that will trigger it starting again. The Audio.Stop All should stop all sounds from playing regardless of the tag.

    Here's an example of how I'm using a mouse click on a sprite event to start music playing. Stopping it is done the same way.

    + Mouse: On Left button Clicked on NewGameButton
    + System: [X] Is ChoiceMade
    -> Functions: Call PlayEffect (Name: "UI_Quirky30")
    

    You'll notice that calls a function. One of the things I do to help keep things organized is to create an entire event sheet just to handle audio events and include it in any other event sheet that needs to play audio. That way I just call a function to play music or sound and pass the file name. If I need to adjust things or change the way all audio is played, I can change the function without having to find every single event where I play audio.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Many thanks BadMario and Fengist, the audio problem's fixed now. :)

    I've now discovered another issue and don't know if I need to start a new topic or not but will post it here anyway.

    On getting a Game Over for the first time the Game Over text displays normally, but on subsequent playthroughs it never appears again until I restart the project preview and I can't work out how to fix this.

  • For that, your best bet is to likely start another topic and post a c3p file. I can think of a hundred things that would keep text from displaying.

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