Posted By: Marky Mark
sound loop - 03/05/07 19:30
Hey,
Here's my rain sound function. I want to start a loop in a certain moment, so i placed the snd_loop in a function that will be called later...
here it is:
Code:
Heres my other function, the one that calls rain_play()
Code:
Here's my rain sound function. I want to start a loop in a certain moment, so i placed the snd_loop in a function that will be called later...
here it is:
Code:
function rain_play()
{
if (snd_playing(rainloopnice) == 1)
{
wait(1);
}
if (snd_playing(rainloopnice) == 0)
{
snd_loop (rainloopnice, 80, 0);
}
}
Heres my other function, the one that calls rain_play()
Code:
while(1)
{
if (vec_dist(my.x, player.x) < my.skill1)
{
if (ObservationConditions == ocAverage)
{
rainit();
rain_play();
}
if (ObservationConditions == ocGood)
{
rainit();
rain_play();
}
}
else
{
// No Rain...
}
wait(1);
}
Code:
When I run my game, it works, but it seems like the sound is playing 200 times
so it looks like a robotic rain sound mixed with a "your computer will crash soon" .. any ideas? thanks



, and i tried, but when i remove the while(1), i can see that it starts raining for a first bunch of particles, but then after those particles, nothing. So i guess i have to place the while(1) in this function, but maybe there's something else to add to the function if i want to stop it when i'm outside the distance of the cloud?