Posted: Sun Nov 08, 2009 1:59 pm Post subject: Using Sound in turing
What is it you are trying to achieve?
Stop the music file from playing if the variable "ammo" is equal to zero.
What is the problem you are having?
I can't get it to work.
Relevant code
Turing:
%check to see if mouse is clicked if button =1then delay(100) Music.PlayFile("fire1.wav")
ammo := ammo - 1 %If ammo is equal to or less than 0, then it equals 0 if ammo <= 0then
ammo :=0 endif cls endif cls
Version of Turing:
4.1.1
Sponsor Sponsor
Superskull85
Posted: Sun Nov 08, 2009 2:27 pm Post subject: RE:Using Sound in turing
You can use Music.PlayFileStop () to stop the playback of music files. If you want your program to continue while playing music, than use Music.PlayFileReturn (FileName : string) instead of Music.PlayeFile (FileName : string).
D_homes
Posted: Sun Nov 08, 2009 2:45 pm Post subject: RE:Using Sound in turing
This still doesnt fix my problem.
Do you mean to change it to this?
if button = 1 then
delay (100)
Music.PlayFileReturn ("fire1.wav")
ammo := ammo - 1
if ammo <= 0 then
Music.PlayFileStop
ammo := 0
end if
cls
end if
I want the .wav to not play when the variable ammo = 0
D_homes
Posted: Sun Nov 08, 2009 3:29 pm Post subject: RE:Using Sound in turing
Anyone?
Tony
Posted: Sun Nov 08, 2009 3:46 pm Post subject: RE:Using Sound in turing
In your current code, you are playing the sound first, then checking to see if ammo is empty. You probably want to have it the other way around.
code:
if button = 1 then
if ammo <= 0 then
ammo := 0
else
Music.PlayFile ("fire1.wav")
ammo -= 1
end if
end if