Game Development Community

Splash screen and GUI "music"

by Stefano Santo Sabato · in Torque 3D Public · 11/13/2009 (1:57 am) · 7 replies

Hi,

I'd like to have some iformations or a tutorial on how to put music into the splash screen or into a GUI.

Thank you very much

#1
11/15/2009 (1:56 pm)
Anyone can help me ???
#3
11/20/2009 (1:43 am)

A simple way is to use the onWake() method.

function MyControl::onWake( %this )
{
   %this.audio = sfxPlayOnce( MyAwesomeSound );
}

This will start the music when the GUI comes up. To end the music when the control is removed, use onSleep.

function MyControl::onSleep( %this )
{
   if( isObject( %this.audio ) )
      %this.audio.stop(); // Place fadeOut on SFXDescription for nice fade.
}
#4
11/23/2009 (12:42 pm)
thank you for your answer.

When I try to put your snippet in my startup GUI it does not work.

console sais to me that there is something wrong in what I'm writing
#5
11/23/2009 (4:20 pm)

Looks like you have a syntax error there. If you post the snippet from the console.log, we can help you further.
#6
11/24/2009 (6:15 am)
thank you.

It was a simple sintax problem :-(
Now audio works.

But I need to stop it before launcing the mission.
Is there a simple way to do this ??

thanks
#7
11/24/2009 (4:19 pm)

As described above, the easiest way is to use onSleep to stop the sound when the GUI is removed from the canvas.