How do I

Get help using Construct 2

Post » Sun Apr 06, 2014 8:54 pm

I have a few levels in my game now. I am trying to have several different background music, a different one for each level.
level 1 layout starts play background 1.....
level 2 layout starts play background 2...

the issue I am having is when the player dies or respawns by leaving the playing area the looping sound that I have starting upon layout out doubles, its like playing over itself...
You do not have the required permissions to view the files attached to this post.
B
9
S
2
Posts: 272
Reputation: 1,632

Post » Sun Apr 06, 2014 9:29 pm

You could just set it so that every time it starts have a stop music then under it have a start music action. That way the music is always stopped every time it starts again.
B
8
S
1
Posts: 76
Reputation: 949

Post » Sun Apr 06, 2014 10:57 pm

when the player its out of layout it restarts the layout....i tried to do a ..when player is out of layout stop music but it doesnt listen to it....it just doubles. it
B
9
S
2
Posts: 272
Reputation: 1,632

Post » Sun Apr 06, 2014 11:04 pm

not sure why the song doubles when layout starts back up
You do not have the required permissions to view the files attached to this post.
B
9
S
2
Posts: 272
Reputation: 1,632

Post » Sun Apr 06, 2014 11:08 pm

Where is the layout restart placed?? I don't see it in your screenshot I only see when out of layout to stop the sound. But what you can do is when the layout starts check if the theme is playing ..if so stop it..then restart it. But depending on where you put the layout restart it could be happening before it gets to the event of stopping the music. So you have to have the music stop event before the layout restart.
B
23
S
4
G
2
Posts: 364
Reputation: 2,392

Post » Mon Apr 07, 2014 12:06 am

aw ok, yea the layout restart is at the beginning of the event page.
B
9
S
2
Posts: 272
Reputation: 1,632

Post » Mon Apr 07, 2014 12:09 am

would i be using an if statement? not sure how to check if its playing?
B
9
S
2
Posts: 272
Reputation: 1,632

Post » Mon Apr 07, 2014 12:50 am

You are trying to stop something that is not there. In the "Stop audio" or what its called it ask for a tag, at the moment your tag is "". So for the background music just add a tag, can be whatever you want it to. And in the "Stop audio" you write this tag instead of the audiofilename and then it works.
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,848

Post » Mon Apr 07, 2014 12:52 am

At the top you should have your on layout start so it should be

on layout start->(subevent)Audio is playing (Audio Tag)->(Action)Audio Stop(AUDIO Tag)

That has to be before the play audio and the way to but it at the bottom of the on layout start event is create a blank subevent below it

Also as a side note::
Just sharing a personal preference The 'On Start of Layout' should be the first event in a eventsheet; IMO because everything executes in order that you have it setup. So nothing should be running before 'On Start of Layout'. Events should be place in level of importance and being that 'On Start of Layout' setup the level it should be number#1
You do not have the required permissions to view the files attached to this post.
B
23
S
4
G
2
Posts: 364
Reputation: 2,392

Post » Mon Apr 07, 2014 1:57 am

]it works, thanks for your help...now its time to figure out how to have each layout play its own unique song.
You do not have the required permissions to view the files attached to this post.
B
9
S
2
Posts: 272
Reputation: 1,632


Return to How do I....?

Who is online

Users browsing this forum: Cubeeo, Yahoo [Bot] and 16 guests