Character Animation

I have a character with walking and running animation.

When i press the right cursor then char starts moving and I want when I press the LShift(while the right key is pressed) the char will start running.


  • But, I cant find a way to figure out how to detect two key press at the same time.



    Another Q is, running, jumping, walking…all of these blending and implementing every possible situation on “onAnimCycleDone” with different Boolean parameters(if run == true while jump animation is running etc etc )…sounds like a big mess.


  • Is there are any general rule that i should follow when working with several animation cycles? Some insight would be a great help.



    I implemented the walk cycle in a different manner then the Examples of jME.

    On keypress detection(onAction), I start the animation and on “simpleUpdate”, i keep on moving the character until the animation ends, so it makes the movement of the character move believable.
  • Is there any problem I might face, if i try to implement all the animation cycles in the this way?
iamcreasy said:
I have a character with walking and running animation.
When i press the right cursor then char starts moving and I want when I press the LShift(while the right key is pressed) the char will start running.

* But, I cant find a way to figure out how to detect two key press at the same time.

well I guess booleans are the way to go : rightPressed, lShiftPressed. Set them to true when pressed.
then...
if (rightPressed && lShiftPressed) run();

iamcreasy said:
Another Q is, running, jumping, walking...all of these blending and implementing every possible situation on "onAnimCycleDone" with different Boolean parameters(if run == true while jump animation is running etc etc )...sounds like a big mess.

* Is there are any general rule that i should follow when working with several animation cycles? Some insight would be a great help.

Well....this being a mess or not is really up to you... the AnimListener is the way to go, there not that much situations to implement.
Of course if you want complex animation you'll have complex code...but everything comes at a cost.

iamcreasy said:
I implemented the walk cycle in a different manner then the Examples of jME.
On keypress detection(onAction), I start the animation and on "simpleUpdate", i keep on moving the character until the animation ends, so it makes the movement of the character move believable.
* Is there any problem I might face, if i try to implement all the animation cycles in the this way?

well...once you have lots of characters animated, you'll face what you wanted to avoid on the previous point : your simpleUpdate method will be a mess...
You should implement some kind of characterControl and attach it to each character. A control has its own update method, so if you have something to do in the update do it there. Besides, it could implement AnimListener so you'll be able to do the anim blending inside.
So everything will be separated and you won't have a 1000 lines simpleUpdate method.