Using level specific Audio datablock files
by Richard Skala · in iTorque 2D · 10/13/2010 (12:43 am) · 3 replies
Is there a safe, reliable method for using level specific audio datablock files?
I have a simple idea for it, and I was wondering if this would be safe.
In game.cs, inside 'startGame(%level)', I simply check against the level that is about to be loaded, and execute the appropriate script containing audio data blocks.
This does load the audio, but is doing it this way safe? That is, when a level is ended and unloaded, are those audio datablocks unloaded along with all the other assets in the level?
In game.cs, at the top of function startGame():
I have a simple idea for it, and I was wondering if this would be safe.
In game.cs, inside 'startGame(%level)', I simply check against the level that is about to be loaded, and execute the appropriate script containing audio data blocks.
This does load the audio, but is doing it this way safe? That is, when a level is ended and unloaded, are those audio datablocks unloaded along with all the other assets in the level?
In game.cs, at the top of function startGame():
%levelFileName = fileName( %level );
if( strcmp( %levelFileName, "Screen_MainMenu.t2d" ) == 0 )
{
exec( "./AudioDataBlocks_MainMenu.cs" );
}
else if( strcmp( %levelFileName, "Screen_MapSelect_PowerUp.t2d" ) == 0 )
{
exec( "./AudioDataBlocks_MapAndPowerUpScreen.cs" );
}
else
{
exec( "./AudioDataBlocks_Levels.cs" );
}About the author
Founded in 2009, Pixel Vandals Inc. is focused on bringing fun, fresh, and new ideas to the iPhone. www.pixelvandals.com www.pixelvandals.com/vineking
#2
10/13/2010 (1:59 am)
I thought about putting them in the per-level datablock files, but if I need to edit them in the TGB editor, won't the entire file get overwritten?
#3
10/14/2010 (1:36 am)
Actually, I just realized that my method cannot work, since the script "startGame()" is only called once, when the game first loads.
Torque 3D Owner Marc Dreamora Schaerer
Gayasoft
with audio you just have the problem that part of it won't even have datablocks (compressed audio)