Game Development Community

Adding different animations

by Jason Hardesty · in Torque X Platformer Kit · 12/23/2007 (4:28 am) · 1 replies

I want to add different animations for punching, kicking and other combat moves and I am having troubles adding them.

I registered an animation state in dragonActorComponent like this:

FSM.Instance.RegisterState(this, "punch");

Then added input in PlayerController like the jump button. Which doesnt make sense. When debugging the jump button being pressed it realy doesnt do anything but change a bool value and I dont see where it calls anything to change the animation to a jump animation. I found where it changes the animations in ActorAnimationManager and created a punch state simular to the jump one but nothing happens when I hit the punch button.

This is what I got for the PunchState in ActorAnimationManager:

public class PunchState : AnimationState
{
public override void Enter(IFSMObject obj)
{
base.Enter(obj);

ActorAnimationManager actorAnimMgr = obj as ActorAnimationManager;

if (actorAnimMgr._actorComponent == null)
return;

actorAnimMgr._transitioningTo = actorAnimMgr._actorComponent.PunchAnim;

if (!actorAnimMgr._transitioning)
actorAnimMgr._playAnimation(actorAnimMgr._transitioningTo);
}

public override string Execute(IFSMObject obj)
{
base.Execute(obj);

ActorAnimationManager actorAnimMgr = obj as ActorAnimationManager;

if (actorAnimMgr._actorComponent == null)
return null;

if (!actorAnimMgr._actorComponent._alive)
return "die";

if (!actorAnimMgr._actorComponent._animatedSprite.IsAnimationPlaying)
return "idle";

return null;
}
}

Has anyone added different states that can help?
Thanks
Jason

#1
12/24/2007 (3:22 pm)
Try using the action animation for other moves. Here's a good thread.

http://garagegames.com/mg/forums/result.thread.php?qt=63687