SoundButtonDown and soundButtonOver
by Stanley D Chatman · in Torque Game Builder · 09/03/2006 (2:10 pm) · 4 replies
Has anyone gotten soundButtonDown and soundButtonOver to work.
I have read the tutorial on these and saw relevant postings but I cannot get any sounds produced
www.garagegames.com/mg/forums/result.thread.php?qt=28663
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=7562
I have read the tutorial on these and saw relevant postings but I cannot get any sounds produced
www.garagegames.com/mg/forums/result.thread.php?qt=28663
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=7562
#2
MainScreen.gui
main.cs
game.cs
customprofile.cs
AudioDataBlocks.cs
09/04/2006 (8:35 am)
Here is my code. It still will not work. I tried changing exec call order also. What version of TGB are you running JOE.MainScreen.gui
new GuiBitmapButtonCtrl(mb1) {
canSaveDynamicFields = "0";
Profile = "myCustomProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "658 4";
Extent = "126 73";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
groupNum = "-1";
buttonType = "PushButton";
bitmap = "~/data/images/mb1";
//soundButtonDown = "buttondownAudio";
//soundButtonOver = "rolloverAudio";
};main.cs
function initializeProject()
{
// Exec game scripts.
exec("./gameScripts/game.cs");
//exec("./customprofile.cs");
// Load up the in game gui.
exec("~/gui/mainScreen.gui");
exec("~/gui/ggSplash.gui");
//exec("~/gui/guiHudGuii.gui");
// Remove the following four lines if you would like to start the game without running the
// level builder.
if ($runWithEditors)
{
toggleLevelEditor();
return;
}
// This is where the game starts. Right now, we are just starting the first level. You will
// want to expand this to load up a splash screen followed by a main menu depending on the
// specific needs of your game. Most likely, a menu button will start the actual game, which
// is where startGame should be called from.
startGame($levelEditor::LastLevel[$currentProject]);
//loadGGSplash();
}game.cs
function startGame(%level)
{
$levelForRestart = %level;
//exec game scripts
exec("./mole.cs");
exec("./moleLevel.cs");
exec("./clouds.cs");
exec("./audioDatablocks.cs");
exec("./customprofile.cs");
exec("./popUpText.cs");
exec("./updateHud.cs");
exec("./weapon.cs");
exec("./utils.cs");
//exec gui files not loaded in main.cs
//exec("~/gui/endScreen.gui");
// Set The GUI.
Canvas.setContent(mainScreenGui);
//Canvas.pushDialog(HudGuii);
//Canvas.setCursor(DefaultCursor);
Canvas.setCursor(CustomCursor);
// Hide the cursor
//Canvas.hideCursor();
moveMap.push();
//$backmusic = alxPlay(backgroundAudio);
sceneWindow2D.setUseObjectMouseEvents( true );
$game::mouseOver = true;
if( isFile( %level ) || isFile( %level @ ".dso"))
sceneWindow2D.loadLevel(%level);
}customprofile.cs
if(!isObject(myCustomProfile)) new GuiControlProfile (myCustomProfile){
soundButtonDown = "buttondownAudio";
soundButtonOver = "rolloverAudio";
};AudioDataBlocks.cs
new AudioDescription(AudioNonLooping)
{
volume = 1.0;
isLooping= false;
is3D = false;
type = $GuiAudioType;
};
new AudioDescription(AudioLooping)
{
volume = 1.0;
isLooping= true;
is3D = false;
type = $GuiAudioType;
};
// --------------------------------------------------------------------
// Background Loop.
// --------------------------------------------------------------------
new AudioProfile(backgroundAudio)
{
filename = "~/data/audio/Music - In-Game.ogg";
description = "AudioLooping";
preload = true;
};
// --------------------------------------------------------------------
// Fire Sound.
// --------------------------------------------------------------------
new AudioProfile(buttondownAudio)
{
//filename = "~/data/audio/UI - Button Click.ogg";
filename = "~/data/audio/generalclick.wav";
description = "AudioNonLooping";
preload = true;
};
// --------------------------------------------------------------------
// Appear Sound.
// --------------------------------------------------------------------
new AudioProfile(appearAudio)
{
//filename = "~/data/audio/wubblegun.wav";
//filename = "~/data/audio/wubblegun.wav";
filename = "~/data/audio/pobblegun.wav";
description = "AudioNonLooping";
preload = true;
};
// --------------------------------------------------------------------
// Rollover Sound.
// --------------------------------------------------------------------
new AudioProfile(rolloverAudio)
{
filename = "~/data/audio/mouse_over.wav";
description = "AudioNonLooping";
preload = true;
};
new AudioProfile(hitheadAudio)
{
filename = "~/data/audio/boing2.wav";
description = "AudioNonLooping";
preload = true;
};
new AudioProfile(starsheadAudio)
{
filename = "~/data/audio/kuku.wav";
description = "AudioNonLooping";
preload = true;
};
#3
Sorry I'm really bad at looking at lots of other peoples code and finding what's wrong!
Here is what I have, this is all you really need to make it happen.
game.cs
mainMenuGui.gui
09/04/2006 (6:30 pm)
Hi Stanley, I'm always running the latest version of TGB ;DSorry I'm really bad at looking at lots of other peoples code and finding what's wrong!
Here is what I have, this is all you really need to make it happen.
game.cs
$channel0 = 0;
new AudioDescription(sfx){
volume = 1.0;
isLooping= 0 ;
is3D = 0 ;
type = $channel0;
};
new AudioProfile(HoverSound){
filename = "T2D/data/audio/click.wav";
description = "sfx";
preload = true;
};
new AudioProfile(ClickSound){
filename = "T2D/data/audio/smash.wav";
description = "sfx";
preload = true;
};
if(!isObject(guimousesoundbuttonProfile)) new GuiControlProfile( guimousesoundbuttonProfile ){
soundButtonDown = "ClickSound" ;
soundButtonOver = "HoverSound" ;
};
exec("T2D/gameScripts/ui/main/mainMenuGui.gui");
exec("T2D/gameScripts/ui/main/mainmenu_functions.cs");
canvas.pushDialog( mainMenuGui ) ;mainMenuGui.gui
...
//one of the buttons
new GuiBitmapButtonCtrl() {
canSaveDynamicFields = "0";
Profile = "guimousesoundbuttonProfile"; // use the new sound-enabled button profile here
HorizSizing = "right";
VertSizing = "bottom";
Position = "121 306";
Extent = "112 42";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
Command = "mainMenuGui.exit();";
hovertime = "1000";
groupNum = "-1";
buttonType = "PushButton";
bitmap = "./menu/ExitButton";
};
#4
exec("./customprofile.cs"); inside my startgame function. All I did was to put them before that startGame function and now it works. Real boner on my part!
game.cs ==> Will not work
game.cs ==> Works Fine
09/15/2006 (6:31 am)
I got it working. My problem was that I had the call to exec("./audioDatablocks.cs");exec("./customprofile.cs"); inside my startgame function. All I did was to put them before that startGame function and now it works. Real boner on my part!
game.cs ==> Will not work
function startGame(%level)
{
$levelForRestart = %level;
//exec game scripts
exec("./mole.cs");
exec("./moleLevel.cs");
exec("./clouds.cs");
exec("./audioDatablocks.cs");
exec("./customprofile.cs");
exec("./popUpText.cs");
exec("./updateHud.cs");
exec("./weapon.cs");
exec("./utils.cs");
//exec gui files not loaded in main.cs
//exec("~/gui/endScreen.gui");
// Set The GUI.
Canvas.setContent(mainScreenGui);
//Canvas.pushDialog(HudGuii);
//Canvas.setCursor(DefaultCursor);
Canvas.setCursor(CustomCursor);
// Hide the cursor
//Canvas.hideCursor();
moveMap.push();
//$backmusic = alxPlay(backgroundAudio);
sceneWindow2D.setUseObjectMouseEvents( true );
$game::mouseOver = true;
if( isFile( %level ) || isFile( %level @ ".dso"))
sceneWindow2D.loadLevel(%level);
}game.cs ==> Works Fine
exec("./audioDatablocks.cs");
exec("./customprofile.cs");
function startGame(%level)
{
$levelForRestart = %level;
//exec game scripts
exec("./mole.cs");
exec("./moleLevel.cs");
exec("./clouds.cs");
exec("./popUpText.cs");
exec("./updateHud.cs");
exec("./weapon.cs");
exec("./utils.cs");
//exec gui files not loaded in main.cs
//exec("~/gui/endScreen.gui");
// Set The GUI.
Canvas.setContent(mainScreenGui);
//Canvas.pushDialog(HudGuii);
//Canvas.setCursor(DefaultCursor);
Canvas.setCursor(CustomCursor);
// Hide the cursor
//Canvas.hideCursor();
moveMap.push();
//$backmusic = alxPlay(backgroundAudio);
sceneWindow2D.setUseObjectMouseEvents( true );
$game::mouseOver = true;
if( isFile( %level ) || isFile( %level @ ".dso"))
sceneWindow2D.loadLevel(%level);
}
Torque Owner Joe Rossi
Indri Games