How do I Keep a song playing across multiple layouts?

Get help using Construct 2

Post » Fri Nov 11, 2016 10:41 pm

I have a Level Select Layout, but I also want a World Select layout. The thing is, I can't figure out how to keep a song playing, even when the World Select layout ends, and it changes to the Level Select Layout. I don't want it to restart, just keep playing.

And the same goes for the levels. I have a song that plays, but when you restart the level, the song restarts, which isn't really a big deal, but it would be better if it just kept playing.

How do I do this? Thanks in advance for any advice!!! :D :D
B
24
S
9
Posts: 109
Reputation: 2,002

Post » Fri Nov 11, 2016 11:30 pm

Music will naturally keep playing, so you must be restarting it either in your "On start of layout", or somewhere else.
ImageImageImage
B
71
S
21
G
232
Posts: 3,695
Reputation: 129,866

Post » Fri Nov 11, 2016 11:41 pm

blackhornet wrote:Music will naturally keep playing, so you must be restarting it either in your "On start of layout", or somewhere else.


Yeah, but I have a retry button that restarts the layout, wouldn't that make the song start again without ending the other song?
B
24
S
9
Posts: 109
Reputation: 2,002

Post » Fri Nov 11, 2016 11:57 pm

Check if music is playing first then, and only start if not playing.
ImageImageImage
B
71
S
21
G
232
Posts: 3,695
Reputation: 129,866

Post » Sat Nov 12, 2016 12:52 am

blackhornet wrote:Check if music is playing first then, and only start if not playing.

I got rid of the event that stopped the music and the end of layout, then I did this, but it still restarts the music.
B
24
S
9
Posts: 109
Reputation: 2,002

Post » Sat Nov 12, 2016 2:34 am

ImageImageImage
B
71
S
21
G
232
Posts: 3,695
Reputation: 129,866

Post » Sat Nov 12, 2016 3:30 am


Oh, I did it slightly different... Thanks for the example! It works! But what if It's a different song between layouts?
B
24
S
9
Posts: 109
Reputation: 2,002

Post » Sat Nov 12, 2016 3:57 am

You can keep track of the current song when you play it, and apply more logic to test if it keeps playing or needs to switch. And/or use "Is tag playing".
ImageImageImage
B
71
S
21
G
232
Posts: 3,695
Reputation: 129,866

Post » Mon Nov 14, 2016 7:29 am

blackhornet wrote:You can keep track of the current song when you play it, and apply more logic to test if it keeps playing or needs to switch. And/or use "Is tag playing".

Thanks for all your help! You've steered me into the right direction! :mrgreen: :mrgreen: :mrgreen:
B
24
S
9
Posts: 109
Reputation: 2,002


Return to How do I....?

Who is online

Users browsing this forum: Baidu [Spider], jorgmaquoi, SignalOne and 17 guests