To play a different music for each layout

Get help using Construct 2

Post » Thu Aug 23, 2012 10:51 am

I need to play a different music for each layout.
If I use the audio command "stop" the music doesn't stop to play.
When the player goes to the next layout the game play togheter the previous music and the current music.
I tried to move the music file from the music folder to the audio folder, but the game play only the music without the sound effects.
How I can manage it?
Thanks
B
11
S
3
G
1
Posts: 13
Reputation: 1,873

Post » Thu Aug 23, 2012 10:32 pm

Try experimenting: Perhaps stopping the music before going to the next layout or using a tag to identify which sound to stop may have better results.
B
19
S
5
G
1
Posts: 104
Reputation: 2,920

Post » Thu Aug 23, 2012 10:49 pm

You can create a text called "music1"(text object), other called "music2" (text object)etc, then place "music1" in layout1 "music2" where you want.(make them invisible)

layout1
"music1"(text) is on screen-play music A
trigger once

layout2
"music2"(text) is on screen-play music B
trigger once

that way you can switch musics by switching textobjects between layouts.



cesisco2012-08-23 22:53:12
B
33
S
11
G
9
Posts: 381
Reputation: 10,153

Post » Thu Aug 23, 2012 11:44 pm

Check my tutorial Asteroid clone in less than 100 events, the "audio system" is doing just what you want to do.

Keep your music files in the music folder, and be sure to tag it when you play it (tag it "BackgroundMusic").
At the end of your layout, Audio: Stop "BackgroundMusic" and on start of the next layout, Play file tag "BackgroundMusic".

Check the tutorial for a more detailed explanation and working example.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Fri Aug 24, 2012 10:02 am

Thanks guys I have fixed the problem adding the tag on the audio play command.
I thought the tag was only a comment to describe the sound played.
B
11
S
3
G
1
Posts: 13
Reputation: 1,873


Return to How do I....?

Who is online

Users browsing this forum: Rezzon71, tarek2 and 22 guests