Music overlaping with itself when the level restarts

Discussion and feedback on Construct 2

Post » Sun Jul 03, 2016 7:11 am

Hi. I'm new to Construct 2, so I was doing the Ghost Shooter tutorial. After finishing it, I wanted to add some sFX and music. I added gunshots for the bullets and a crunchy gory sound for when the player dies. Everything is fine with those short sounds. However, I'm having a problem with the music loop. Everytime the player dies and then presses the space bar to restart the game, the music also restarts and overlaps the previous iteration of itself. It happens on every restart. A new iteration of the music overlaps on top of each one of the previous ones, causing a confusing cacophony of looping tracks. What I want is the music to play on start only once, and then just looping without being interrupted or buried beneath a repetition of itself because of a restart. I'm attaching a screenshot of my current event sheet. Thanks in advance.

(Since I'm from Latin America, there's some spanish words on it. "Salud" goes instead of "Health", "Puntuación" instead of "Score" and "Barra Espaciadora" goes for the"space bar")Image

...And yes, I've replaced the ghost with an image of Giorgio Tsoukalos, because, why not? :P
B
5
S
1
Posts: 4
Reputation: 333

Post » Sun Jul 03, 2016 8:23 am

You should have tags with your sounds and music, doing so you will be able to check if the music is already playing before playing it again, or stopping it before playing it again (heck, it might even solve the issue by itself as I think there can be only one sound playing with the same tag at a time)
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Sun Jul 03, 2016 8:24 am

When your player dies put a command to stop the music. Also put the music to restart when you press restart button.
Check out my awesome Android Game releases https://play.google.com/store/apps/deve ... ames&hl=en
B
38
S
18
G
24
Posts: 681
Reputation: 16,613

Post » Mon Jul 04, 2016 6:24 am

I really don't want the music to restart with the space bar. I would like it to keep looping all the time, while only the layout restarts. The sound file has to be initialized only once, and then just keep looping.
Also, as I've said, I'm new to Construct, so I don't know how to tag the sounds. Sorry to bother you, and thanks in advance.
B
5
S
1
Posts: 4
Reputation: 333


Return to Construct 2 General

Who is online

Users browsing this forum: Apollo14, JesusJ, Palnix777 and 14 guests