Game Development Community

Sounds in GUI

by Stephen Hagyard · in Torque Game Engine · 07/08/2003 (6:52 pm) · 1 replies

What do I add to the datablock to make a sound (wav file) play when the button is pressed?

Thanks in advance - Stephen Hagyard.

#1
07/09/2003 (5:26 am)
I actually just looked into this yesterday. In client/ui/defaultGamePofiles.cs add this towards the top:

GuiButtonProfile.soundButtonDown = "AudioButtonOver2";

Then in client/scripts/audioProfiles.cs add:

new AudioProfile(AudioButtonOver2)
{
filename = "~/data/sound/buttonDown.wav";
description = "AudioGui";
preload = true;
};

This will add the buttonDown sound when any of the buttons are pressed. You can of course use different profiles to make different sounds for specific buttons.

-Sabrecyd