Quote:
I don't want this function to be called when the game_state = 1,2,or 3.
I don't understand why the first example doesn't work, but
if written the second way, it does work.
Code:
starter rival_activity()
{
while(game_state == 0)
{
snd_play(bad_news_snd,100,0);
wait(1);
}
}
Code:
starter rival_activity()
{
while(1)
{
if(game_state == 0)
{
snd_play(bad_news_snd,100,0);
}
wait(1);
}
}
starter rival_activity()
{
while(game_state == 0)//zero was defined by some earlier function?
{
snd_play(bad_news_snd,100,0);//plays sound
wait(1);
}
}
is saying while game_state is zero play the bad news sound.... basically its saying that its going to always be zero or it was set to zero by some other function. like var game_state = 0 or a function saying function
function_name
{
game_state = 0;
}
-----
starter rival_activity()
{
while(1)//while...
{
if(game_state == 0)//if game state reaches zero ...
{
snd_play(bad_news_snd,100,0);//...then play the sound
}
wait(1);//wait like your supposed to 
}
}
this is saying while this happens start the if statement which is...if game state is zero play the bad news sound...instead of saying that it was already 0 or setting it as zero. thats my understanding of it 