Action Game Logic

Hey all,

I am currently working on a 3rd person action/fighting game. I know how to rig objects with armatures, assign different animated actions to the armature, and use the logic bricks to play the animations on key presses.

The one problem I have is getting the logic to work. All I need is that when no key is pressed, the object goes idle. You press the WASD keys, it moves in those directions, switching the animation to a walk cycle. When the key is released, the animation switches back to idle. In other words, how do I structure the logic blocks to give it normal action game controls, with other actions like punching and jumping?

I’ve attached my .blend file. It has no logic, just a rigged object with three actions: walk, punch, and idle.

Thanks for your time.


Puncherman.blend (156 KB)

There are lots of ways to do this.

The easiest way for the “Idle” animation is to simply have an always sensor triggering the idle animation. Set the action actuator’s priority to be high-ish (like 5) and then add a few “Blendin” frames.

Now have your keys trigger the punch/walk animations, but give them a lower priority number (lower priority numbers mean that they will be the ones that are played).

That’s pretty much it for animtions.