Game Development Community

Play animation after being shot

by William James · in Torque Game Engine · 05/29/2007 (8:59 pm) · 2 replies

I have a shape and I want the shape animation to play once it is shot three times.
How would I detect when the projectile has collided with the shape 3 times in order to get the animation to play? Any help would be nice :)

#1
05/30/2007 (5:47 am)
If you are using the default starter.fps setup for damage, you can use %obj.getDamageLevel(); and compare that to a value you decide on. That would be just a simple if check:

if(%obj.getDamageLevel(); > $DamageThreshHold)
     %obj.playThread(0, "bigDamage");
#2
05/30/2007 (7:33 pm)
I placed this code in athe items .cs file and nothing happened. Another thing is in the Inspector my object keeps
showing up as TSStatic which if I read correctly can't play animations
datablock ShapeBaseData ( GirlTarget )
{
		category= "target";
		shapeFile="'data/shapes/target/Gun_Target.dts";
		sequence0 = "fall.DSQ  fall";
	};
	
function GirlTarget::onCollision(%this, %obj, %col)
{
if(%col.getClassName() $= "Projectile")
{
	%obj.playThread(0, "fall");

}
}

BTW I am using FPS Starter kit but with ModMakerWeapons if that even matters