Game Development Community

GUI Sound problem

by Rodney (OldRod) Burns · in Torque Game Engine · 06/19/2004 (1:26 pm) · 2 replies

I finally got GUI sounds working (thanks to Britton LaRoche for his email help :))

Now I have a problem. I have a sound assigned to be played when the 'exit' button is clicked on my menu. The problem is, the game exits before the sound actually plays (it's only 1 sec long, so it's not like a long one or anything).

Is there a way to make a small delay from the button click to the 'quit();' command being executed in order to allow for the sound to play?

Once I get this all working like I want, I'll write up a resource. It was not easy :)

#1
06/19/2004 (1:48 pm)
Using schedule would work.

function Exit01()
{
alxPlay(MenuDraw);
schedule(1000,0, "Exit02");
}

function Exit02()
{
quit();
}
#2
06/19/2004 (3:37 pm)
Ah, that worked.

Only problem I had was that I didn't need quotes around the "Exit02". That threw me for a bit :)

Thanks for the help!