Onimpact
by Anthony Ratcliffe · in Torque Game Builder · 12/10/2008 (4:57 pm) · 1 replies
Can anyone see where the mistakes are in this the engines not throwing any errors. the idea is on a drop it invokes damage and applys it to make damage, if damage is == 0 it plays the death animation
exec("~/data/shapes/soldier/soldier.cs");
datablock PlayerData(PlayerDB)
{
renderFirstPerson = false;
emap = true;
shapeFile = "~/data/shapes/soldier/soldier.dts";
cameraMaxDist = 4;
maxInv[GunAmmoDB] = 50;
maxInv[GunDB] = 1;
damage = 2;
maxDamage = 1;
repairRate = 0.0;
};
function PlayerDB::onImpact(%this, %obj, %collidedObject, %vec, %veclen, %damage )
{
%obj.applyDamage(%damage);
if %obj.maxDamage == 0
{
%obj.playDeathAnimation();
}
}
function Player::playDeathAnimation(%this)
{
%obj.playThread(0,"death1");
}
function PlayerDb::onAdd(%this,%obj)
{
%obj.setRepairRate(%this.repairRate);
}
exec("~/data/shapes/soldier/soldier.cs");
datablock PlayerData(PlayerDB)
{
renderFirstPerson = false;
emap = true;
shapeFile = "~/data/shapes/soldier/soldier.dts";
cameraMaxDist = 4;
maxInv[GunAmmoDB] = 50;
maxInv[GunDB] = 1;
damage = 2;
maxDamage = 1;
repairRate = 0.0;
};
function PlayerDB::onImpact(%this, %obj, %collidedObject, %vec, %veclen, %damage )
{
%obj.applyDamage(%damage);
if %obj.maxDamage == 0
{
%obj.playDeathAnimation();
}
}
function Player::playDeathAnimation(%this)
{
%obj.playThread(0,"death1");
}
function PlayerDb::onAdd(%this,%obj)
{
%obj.setRepairRate(%this.repairRate);
}
About the author
Torque Owner Anthony Ratcliffe