How do I Stop Sound From Playing

  • I have got the basics down for a game I am making. however I ran into a snafu and not even the great Google could help. When you die inside of a nebula the ships alarm keeps going off. I do have a stop action set to it. The weird part is the sound keeps playing even after going back to the main menu. This only happens when it is on server side and not local testing

    Game

    psychohamstergames.com/games/spacegame

    CAPX File

    drive.google.com/open

  • You've got the events to play the sound looping first, then waiting 2 seconds, playing it without looping, then stopping. My guess is that your game is going to the next layout when the looping version is playing. Try to set those sounds to play without looping - I think that will fix the issue.

    In addition, on the start of your opening layout, you can set the sound to stop. That way, when that layout is opened up again, the sound no longer plays.

  • You've got the events to play the sound looping first, then waiting 2 seconds, playing it without looping, then stopping. My guess is that your game is going to the next layout when the looping version is playing. Try to set those sounds to play without looping - I think that will fix the issue.

    In addition, on the start of your opening layout, you can set the sound to stop. That way, when that layout is opened up again, the sound no longer plays.

    I had it looping because I wanted it to give two buzzes. I sort of figured it out by placing the stop in the health check and crew member check of the player. I tried doing it on the main menu but it still kept going off for some reason. So I am guessing it would be better to make that alarm file sound off twice in audacity and then re-import?

    EDIT: So if I only wanted the alarm to go off while in the nebula how would I go about doing that. Would it be another event or an action to the existing event?

  • Hey there! You can make one file with it playing twice, as you suggested....ooooor you could just set it to play not looping, wait 1 or 2 seconds and play the sound one more time.

    Currently, the alarm is set to stop playing at the start of "level 1" and not on the main menu event sheet. You'll want it there since you're loading that layout when the level layout ends. Just to make sure there wasn't an issue with your file, I tried this and it works jut fine for stopping the alarm.

    As for an easy way to playing the sound while overlapping the nebulas:

    if player is overlapping nebula + once while true (This is in the system object) - play sound looping

    else - stop playing sound

    If you do that, you'll want to adjust your collision boxes because some look a tad off.

    I'd also recommend that you condense your 3 nebulas into one object with 3 frames for it's animation (and set that animation speed to 0, the default should be 5). You can change how the object reacts to the payer depending on which frame is active in the nebulas animation (quick example: if nebula is playing animation "default" and it is at frame 2, subtract 5 health from player).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • every tick / on overlapping object / play sound

    should work as it should loop until no overlapping.

  • Carbincopy I'm not so sure, I think the sound would play every tick that way (60 times a second).

  • Thanks for the help gang

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