Author Topic: Face Player onDeath  (Read 1112 times)

I have the euler rotations set up and everything, the only issue is that I can't figure out how to call it onDeath. onCollision and onDamage did not work for me. Maybe I used the incorrectly, I don't know. I need to find the killer and the killed for my rotational code to work.
« Last Edit: June 11, 2013, 09:33:06 PM by tommybricksetti »

Code: [Select]
function gameConnection::onDeath(%this,%obj,%killer,%type,%area)
{
parent::onDeath(%this,%obj,%killer,%type,%area);
%eulerRotation = axisToEuler(getWords((%obj.getTransform()),3,6));
%eulerXY = getWords(%eulerRotation,0,1);
%eulerZ = getWord(%eulerRotation,2);
if(%eulerZ <= 0)
{
%eulerZ += 180;
}
else
{
%eulerZ -= 180;
}
%oppositeEulerRot = %eulerXY SPC %eulerZ;
%locA = %obj.getTransform();
%locB = getWords(%locA,0,2) SPC eulerToAxis(%oppositeEulerRot);
%obj.setTransform(%locB);
talk("onDeath called");
}
This is packaged and the talk doesn't even get called.

... are you 100% sure you are activating the package?

Try calling the parent after the code..See if that works.

and..
... are sure you are activating the package?


When the player dies most of the functions to do with the player object get disabled, and no longer work properly. Do what Visolator said, and move the parent to the bottom of the function.