How do I Stop Sound From Playing

Get help using Construct 2

Post » Tue Jan 05, 2016 2:40 am

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
http://www.psychohamstergames.com/games/spacegame/

CAPX File
https://drive.google.com/open?id=0B744DbKR7RZ9bFJXUlJKTExUSVE
B
9
S
1
Posts: 8
Reputation: 719

Post » Tue Jan 05, 2016 3:07 am

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.
B
64
S
38
G
24
Posts: 352
Reputation: 17,981

Post » Tue Jan 05, 2016 3:21 am

ultrafop wrote: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?
B
9
S
1
Posts: 8
Reputation: 719

Post » Tue Jan 05, 2016 5:00 am

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).
Last edited by ultrafop on Tue Jan 05, 2016 5:25 am, edited 2 times in total.
B
64
S
38
G
24
Posts: 352
Reputation: 17,981

Post » Tue Jan 05, 2016 5:16 am

every tick / on overlapping object / play sound

should work as it should loop until no overlapping.
B
29
S
13
G
10
Posts: 355
Reputation: 8,317

Post » Tue Jan 05, 2016 5:21 am

@carbincopy I'm not so sure, I think the sound would play every tick that way (60 times a second).
B
64
S
38
G
24
Posts: 352
Reputation: 17,981

Post » Wed Jan 06, 2016 6:03 am

Thanks for the help gang
B
9
S
1
Posts: 8
Reputation: 719


Return to How do I....?

Who is online

Users browsing this forum: asdtricky, brunopalermo and 20 guests