Page 1 of 1

Changing animation when moving

PostPosted: Sun Feb 27, 2011 5:59 am
by phyzix5761
I have a quick question, if you guys could please help me out.

I have created an actor that response to w,a,s,d for movement. The keys also control the walking animation for the actor. When the key is up the actor is instructed to return to the non-moving animation and halt movement in that direction. But I have an animation problem. I will illustrate with an example.

I press S to walk down. The animation works fine. I press D to walk right but decide to leave S pressed as well. The character moves in both directions but if I stop pressing one of the keys the actor's animation returns to non-moving although he is still moving. Is there any way I can fix this?

Thank you!

Re: Changing animation when moving

PostPosted: Sun Feb 27, 2011 8:35 am
by skydereign
That's called moonwalking. There are many fixes to moonwalking, but my favorite is by using a state variable. Here's an example of what I mean.
http://game-editor.com/forum/download/file.php?id=4965

If you want an explanation with it you can go here, or I can pm you the details.
http://game-editor.com/Moonwalking

Re: Changing animation when moving

PostPosted: Thu Mar 03, 2011 8:01 pm
by phyzix5761
Thank you.