How do I make a character idle?

So I have a setup where when the user presses the up arow, it moves the character forward. I want to know how to make the character’s legs go back to normal position when the user isn’t pressing the up arrow. (Or any other method of doing that, for the matter.)

BlenderCookie.com’s “Game Character” tutorial shows one way to do it - attach an always sensor to your idle animation

in order to get it to blend back in nicely though, i think the best idea is to attach all your movement sensors to a ‘not’ gate, and then attach that to your idle anim.

I understood the first part. But I really don’t understand what you’re saying in the second part.

Take all the sensors that make the character do things, connect them to a NAND(I think) controller, connect that to the idle actuator.

one good way ist to switch between states. So you define:

  • an idle state
  • a forward state

Each state activates all necessary actuators to perform the animation for its state. If you want to switch, just switch to the other state. E.g. from forward state to idle state.

This keeps the logic of a state small and clean, and allows a lot of more states.

Monster, what do you mean “define:
-an idle state
-a forward state”

What do you mean by define?

<<What do you mean by define?>>
Well, “define” means “create”, I guess!
Before you must “create” and “idle” action in the Action Editor, the same way as you created the “walk” one
When you add a “Controller” you “create” a “state”
Then add:
Always Sensor -> AND -> Action Actuator - idle
Keyboard Sensor - UpArrow -> AND - State Actuator - Add State 2

In state 2 ( press second little square button in first row), add:
Always Sensor -> AND -> Action Actuator - Walk

And so on ( you must complete/fine tune the setup )
Bye

I did that, and it just stayed at the idle state. I think my problem is that I didn’t connect the state 2 with the walk cycle. How do I do that? By the way, here’s my sequence:
Always -> and -> action (idle)
Keyboard (up) -> and -> state (2)
Always -> play -> action (walk)

Thanks.

As OTO wrote, you “define” a state just by giving them a meaning e.g. state 1 = idle, state 2 = walk ;). The states are already there. You need to fill it wiht logic that fits the meaning you “defined” earlier. I think you already got that.

To make your walk state do anything:
Enable Level at the always sensors. Otherwise it sends a pulse just once and not after changing the state.
This is important as actuators from inactive states are automatically deactivated (in your case your action actuator).

You can debug the state by enabling the “D” of the controller and enable show debug properties in the game menu. So can see what state the controller is.

I’ve made a little example for you:
http://otothecleaner.free.fr/downloads/States_Example_Littleoto.blend
Bye

Okay, I’m just going to tell you what I created customly for my character (as your’s was different than mine), and I hope you can tell me how to make it work. Here’s the sequence:
Keyboard (up arrow) -> and -> property (state - 2)
Property (when state is 2) -> and -> action (walk action)
Property (when state is 1 - which is the starting value) -> and -> action (idle action)

I want to know how to make state = 1 when the the up arrow is not being pressed. Thanks guys.

Well…try to add this Logic just after your first line:
Keyboard ( up arrow) Inv enabled -> and -> property ( state - 1)
Bye

Yay, thanks!

if the only action ur character does is to move forward , u can do the thing I did:
make a sensor :
keyboard button W (example) - Controller - Action
keyboard button W Inverted (that means it activate when u are not pressing “W”) - Controller - Idle State

an other thing to look out for is using action actuators

I had a similar problem for weeks. (I needed to check the actions priority, lower numbers mean more important)

just something to check if your still having problems.