InputHandler Action When No Keys Pressed

I trying to write an Action much like in FlagRushTut or FirstPersonHandler that gets called when no keys are pressed. Such that my animation of my character can return to idle, instead of continuously playing a different animation.  Something like DriftAction might work, but that gets called every frame, I only want this to be called when no keys are pressed.  Any suggestions?



Thanks in Advance.  :)

Quick (,dirty) and easy solution. Give your keybindinglisteners or whatever way is used to listen to the commands

the command to set a flag (a boolean) when a key is pressed.

Check in the update routine if the flag is positive (a key is pressed) or negative (no key pressed).

If no key is pressed, proceed with the action that is executed when no key is pressed.



The nicest way would be to use a listener that is activate when no key is pressed, but I don't know where the

data of pressed keys is kept. That you'll have to hunt down yourself :stuck_out_tongue:

Really you can do keybindinglisteners in InputHandler?  I look into it.

SomethingNew said:

Really you can do keybindinglisteners in InputHandler?  I look into it.


If you got some solutions, I would be interested in them. Got exactly the same problem.