function PuckArmor::onCollision(%this,%obj,%col,%thing,%other)
{
//echo("PUCK COLLUSIONE!!!1!");
if(%col.getType() & $TypeMasks::PlayerObjectType) //Oh and by the way, for some reason it's always calling this even when it's not a player any idea why?
{
%image = %col.getMountedImage(0);
//Echo(%image);
if(isObject(%image) && %image.HockeyStick )
{
echo("reg");
%col.unmountimage( 0 );
//echo("HOCKY STIK W PUCK");
%col.mountImage(HockeyStickWPuckImage, 0);
//echo("has puck");
%col.hasPuck = 1;
%col.hasSportBall = 1;
%obj.delete();
//echo("parent dat sheet");
return;
}
else if(isObject(%image) && %image.GoalieStick )
{
echo("goalie");
%col.unmountimage( 0 );
//echo("HOCKY STIK W PUCK");
%col.mountImage(GoalieStickWPuckImage, 0);
//echo("has puck");
%col.hasPuck = 1;
%col.hasSportBall = 1;
%obj.delete();
return;
}
}
//Like this??
%objectVelocity = %this.getVelocity();
%fvec = %this.getFowardVector();
%svec = vectorScale(%fvec,-1);
%fvel = vectorScale(%objectVelocity, -1);
%vel = vectorAdd(%fvel,%svec);
%this.setVelocity(%vel);
parent::onCollision(%this,%obj,%col,%thing,%other);
// do onBallHit event, only call this on bricks obviously
if( %col.getType() & $TypeMasks::FxBrickObjectType )
echo("onballhit");
%col.onBallHit( %obj.sourceObject, %obj );
}
This is all of my oncollision function