Code Snippets

Jquery Countdown Script

Posted by admin on January 19, 2012 at 9:24 am

So, I had the need the other day for one of those “if your page does not redirect in X seconds, click here” scripts where the X would count down. Here is a little piece of jquery i wrote to handle this.

TGB Level Loader

Posted by admin on March 15, 2010 at 5:38 pm

So working with a new board selection class for La Box and I came across a nice little piece of code for loading levels.

Dynamic Position Particle Effects

Posted by admin on March 10, 2010 at 7:09 pm

So when I was working on some of the power ups for La Box I needed a way to display several particle effects on the screen at the same time. So what i did was create a function to do this for me.
function CreateGroundPountEffect(%pos)
{
%particle = new t2dParticleEffect();
%particle.addToScene($sceneGraph);
%particle.loadEffect(”~/data/particles/SmokePuff.eff”);
%particle.Position = %pos;
%particle.playEffect();
}
Use this function and pass in the [...]

TGB Audio Setup

Posted by admin on March 10, 2010 at 7:06 pm

Here is a sample audio setup class for torque game builder. Simply create a new script file. Add in the following.
new AudioDescription(AudioNonLooping)
{
volume = 1.0;
isLooping = false;
isStreaming = true;
};
new AudioDescription(AudioLooping)
{
volume = 1.0;
isLooping = true;
isStreaming = true;
};
new AudioProfile(AudioSpaceBass)
{
filename = “~/data/audio/SpaceBass.wav”;
description = “AudioLooping”;
preload = true;
};
Execute the script in game.cs. then use alxPlay(AudioSpaceBass); anywhere you want to play the [...]