- Home /
Question by
Trorlroprlro · Nov 02, 2013 at 04:13 PM ·
audioaudioplay
Background music help
I'm trying to make it when i collect pages in my slender game. The music changes. I have 3 different self made audio clips for the music. But when i collect the pages the music plays horribly stacked. Heres the part of my code:
if(pages == 6){
Application.LoadLevel(3);
}
else if (!audio.isPlaying && pages >= 5) {
audio.clip = Page5_6;
audio.Play ();
}
else if (!audio.isPlaying && pages >= 3) {
audio.clip = Page3_5;
audio.Play();
}
else if (audio.isPlaying && pages >= 1) {
audio.clip = Page5_6;
audio.Play();
}
Comment
@tanoshimi Yup fixed that but how do i fix the stacking problem?
Answer by Rabbit · Nov 02, 2013 at 05:13 PM
you are playing 5_6 twice this line is missing the !
else if (audio.isPlaying && pages >= 1)
replace with
else if (!audio.isPlaying && pages >= 1)
Answer by JoeMGomes · Nov 02, 2013 at 06:21 PM
You need to replace the line:
else if (audio.isPlaying && pages >= 1)
With:
else if (!audio.isPlaying && pages >= 1)