Getting a forward and backward walk to work in game engine

Hey Guys,

I’ve been working on a game concept for a while now. I have done a simple walk and run cycle for a character and got it working in the game engine. The attached file is below.

ElianAnimation.blend (536 KB)

The problem I’m facing is getting the character to walk or run backwards. I have parented a cube to my armature. So my armature handles the animation through Action logic bricks and the my cube handles actual movement. I cant figure out how to use my walk cycle for my backward movement, using it directly with a motion actuator will just cause the character to moonwalk.

Even if I totally do a backwards walk and run animaton when the character stops, it will snap back to the idle animation which is facing in the front direction.

Does anyone have any solutions for this?

I do have a couple of other problems(push animation, collision issues) but I’d like this to be solved first.

Chances are my misunderstanding is due to me being dense, however - I’m not totally sure what problem you’re having.
Are you trying to make them still face forwards but step backwards or turn around to walk the opposite way?

If you want them to physically turn around and walk/run the opposite way then you’ll need to use rotation by 180 degrees on the cube - using states or properties you could set it so that when facing the right pressing ‘D’ won’t rotate you but pressing ‘A’ will, and vice versa, while facing the left pressing ‘A’ won’t rotate you but make you walk, whereas ‘D’ will rotate you.

If you wanted to make the character still facing one direction but stepping backwards you’d simply need a backwards walking animation.

I hope my makeshift answer can help you with this problem, otherwise I’m sure somebody else could! :slight_smile:
Good luck with your game!

It sounds like your back walking animation turns him to face backwards then walk?
if so, ditch the turning around on the animation, and make the actual cube turn.

A tip - if you make a game property on the armature, call it “WalkFr” or something, then put this name in the “FrameProp:” box on the action actuator, then find the frames when your character actually steps forward (foot on ground moving back) then make a property sensor interval, lets say the above is between frames 10 - 20, then put that in the interval boxes, then connect this to all your controllers that make him move forwards, this way, he only moves forwards when his foot is on the ground, it looks way more natural than this sliding effect everyone achieves.

A tip - if you make a game property on the armature, call it “WalkFr” or something, then put this name in the “FrameProp:” box on the action actuator, then find the frames when your character actually steps forward (foot on ground moving back) then make a property sensor interval, lets say the above is between frames 10 - 20, then put that in the interval boxes, then connect this to all your controllers that make him move forwards, this way, he only moves forwards when his foot is on the ground, it looks way more natural than this sliding effect everyone achieves.

Ooh, that’s good…

thanks

like the signature :smiley:

Thanks for the tips guys…I’ll give property sensor thing a shot.

Controlling the cube and rotating it forwards and backwards I think is a good idea. However, how do I go about doing it with properties or states. I tried using a ‘track to’ actuator with the cube tracking to two boxes on either side of the level but it doesnt seem to work too well.
Also is there any way to lock the character and object movement to just a 2d plane?