music problems

Blitz3D Forums/Blitz3D Programming/music problems

Ruz(Posted 2004) [#1]
I have an event which triggers the music to play

ie if score>5
PlayMusic( titlemusic)
EndIf

It works but the music seem to trigger over and over again
reulting in a cumulative mess of noise. How can I fix this anyone

My guess is that because the score of 5 once reached is always 5 its triggering the music over and over again


Rob Farley(Posted 2004) [#2]
;init
playing_title=false

...

if score>5 and playing_title=false
title_sound=playmusic(titlemusic)
playing_title=true
endif


Now this will work if you only want it to play once.

The title_sound varible allows you to check channel stuff ie,
if channelplaying(title_sound) then blah blah
or 
channelvolume(title_sound,volume#)

Just better really.


Ruz(Posted 2004) [#3]
Thanks Rob. off to try it now.
Thats an example of flag is n't it
I already used one to open a door if certain conditions are met. Should have thought about the same mehtod here. ahh
well.


Ruz(Posted 2004) [#4]
Rob had few probs with that. it only worked by deleting the first bit ie
playing_title=false

But it works now thats the main thing.


(tu) ENAY(Posted 2004) [#5]
> Rob had few probs with that. it only worked
> by deleting the first bit ie playing_
> title=false

In that case you probably need to declare playing_title as global since I bet you're doing that if score>5 stuff in a function. Maybe!