//=============================================================================
// GasbagBelch.
//=============================================================================
class GasbagBelch expands Projectile;

#exec TEXTURE IMPORT NAME=gbProj0 FILE=MODELS\gb_a00.pcx GROUP=Effects
#exec TEXTURE IMPORT NAME=gbProj1 FILE=MODELS\gb_a01.pcx GROUP=Effects
#exec TEXTURE IMPORT NAME=gbProj2 FILE=MODELS\gb_a02.pcx GROUP=Effects
#exec TEXTURE IMPORT NAME=gbProj3 FILE=MODELS\gb_a03.pcx GROUP=Effects
#exec TEXTURE IMPORT NAME=gbProj4 FILE=MODELS\gb_a04.pcx GROUP=Effects
#exec TEXTURE IMPORT NAME=gbProj5 FILE=MODELS\gb_a05.pcx GROUP=Effects

#exec AUDIO IMPORT FILE="Sounds\flak\expl2.UFX" NAME="expl2" GROUP="flak"

var() texture SpriteAnim[6];
var int i;


function Timer()
{
	Texture = SpriteAnim[i];
	i++;
	if (i>=6) i=0;
}


function PreBeginPlay()
{
	if ( ScriptedPawn(Instigator) != None )
		Speed = ScriptedPawn(Instigator).ProjectileSpeed;
	PlaySound(SpawnSound);
	Velocity = Vector(Rotation) * speed;
	MakeNoise ( 1.0 );
	Texture = SpriteAnim[0];
	i=1;
	SetTimer(0.15,True);
}

auto state Flying
{


function ProcessTouch (Actor Other, Vector HitLocation)
{
	if (Other != instigator)
	{
		Other.Damage(Damage, instigator,HitLocation,
				15000.0 * Normal(velocity), 'burned');
		Explode(HitLocation, Vect(0,0,0));
	}
}

function Explode(vector HitLocation, vector HitNormal)
{
	if (FRand() < 0.5)
		MakeNoise(1.0); //FIXME - set appropriate loudness
	Spawn(class'SpriteBallExplosion',,,HitLocation+HitNormal*9);
	Destroy();
}

Begin:
	Sleep(1.5);
	Explode(Location, Vect(0,0,0));
}

