Sound: play/stop

Get help using Construct 2

Post » Thu Jul 11, 2013 1:19 pm

Hello everyone

I'm currently making a mobile game and I have run into a issue that I hope you guys can help me solve. Every level in my game has a soundtrack and sound fx, the problem I'm facing is when changing layout to a new level the previous soundtrack keeps playing over the new soundtrack. So how can I make it so when changing layout (level) the previous soundtrack stops and the new one plays? Thank you for your time :)
B
6
S
2
G
3
Posts: 22
Reputation: 2,426

Post » Thu Jul 11, 2013 1:45 pm

Hello @creamcakes

You should use 2 things :
- the events "on start of layout"/"on end of layout"
- tags for your sounds.

At the start of layout, start playing soundtrack with tag "soundtrack".
At end of layout, stop playing "soundtrack"
(those are actions of the Sound object)
If you add a global variable in each layout, variable containing the name of the soundtrack, you can just have those 2 sound events in every layout , just using the variable to play the wanted soundtrack.
B
17
S
8
G
4
Posts: 461
Reputation: 6,077


Return to How do I....?

Who is online

Users browsing this forum: Fenix18, kiko2015, QuantumMMX and 7 guests