Really simply question about playing animation on collision
by Orion the Hunter · in Torque Game Builder · 07/26/2013 (9:16 am) · 2 replies
Hi, I apologize for posting while I have another issue open, but this one is fairly small.
I'm trying to make it so when you hit an object, it plays an animation. Here's what I have:
However, my console is giving me this error:
~ Orion
I'm trying to make it so when you hit an object, it plays an animation. Here's what I have:
if (!isObject(TuftPickupBehavior))
{
%template = new BehaviorTemplate(TuftBehavior);
%template.friendlyName = "Tuft of Grass Behavior";
%template.behaviorType = "Enviroment";
%template.description = "Makes the tuft of grass blow when the player runs through it.";
}
function TuftBehavior::onAddToScene(%this, %scengraph)
{
%this.Owner.CollisionActiveRecieve = "1";
%this.Owner.CollisionActiveSend = "1";
%this.Owner.CollisionCallback = "1";
%this.Owner.Immovable = "1";
%this.Owner.setCollidesWith( "ActorObject" );
}
function TuftBehavior::onCollision( %this, %theirObject )
{
echo(%this.Owner @ " has been collided with!");
if(%theirObject.FlipX)
{
%this.owner.flipX = 0;
}
else
{
%this.owner.flipX = 1;
}
%this.Owner.playAnimation(TuftAnimation);
}However, my console is giving me this error:
Quote:game/behaviors/TuftBehavior.cs (32): Unknown command playAnimation.The problem is with the fact that it won't play the animation. it's weird because I can use that function outside of a script (in the console) and it works just fine, and %this.Owner is being recognized and everything... do you know what the problem is?
Object (2792) t2dStaticSprite -> t2dSceneObject -> BehaviorComponent -> DynamicConsoleMethodComponent -> SimComponent -> SimObject
~ Orion
Torque 3D Owner Harry Durnan