I am trying to do a little setup to test animations for a Street Fighter style game but I just can't figure out excactly how the AnimState works.
This is how I do it now:
I am working in a frameListener that gets an Entity passed.
In a keyPressed method I write what the 'latest pressed action' is. For example newAction="walkForward"; Different for different keyes.
In frameBegin I check what is the newAction and calls a method to play that particlar animation.
That method that plays the animation looks something like:
Code: Select all
animationState = ent->getAnimationState( "WalkF" );
animationState->setLoop( true );
animationState->setEnabled( true );
animationState->addTime( myTimeSinceLastFrame );
!! The Problem:
When I test the program and first hit a key, it looks fine.
But when I try to play the next animation, it looks stumped, like it's only playing part of it.
And then when I try to play the first one again, it looks wrong also.
I have tried to 'rewind' the animationState's with some limited sucess but I am not sure if that is how to do it. Seems a bit messy?
any tips would be much appreciated
cheers
fred