Teach the Player to jump

Hi,



we are experimenting with jme3 and our current experiment is based on walking_character

We changed the model to the Ninja because it has a jump animation.

We changed the jumpSpeed to 20f and thought we can call the jump animation just by adding these lines:



[java]

if (airTime > 0.01f) {

if (!“Jump”.equals(animationChannel.getAnimationName())) {

animationChannel.setAnim(“Jump”);

}

} else if (!“Walk”.equals(animationChannel.getAnimationName())) {

animationChannel.setAnim(“Walk”, 0.2f);

}

[/java]



But now everytime we are jumping the animation is starting new, so the jump animation is overlayed by the next jump animation…



Can anybody help us?

Add two Boolean’s or one if you think it out carefully. In a way you already have but you need to be able to track this. If Jump track is already playing don’t run. if Finished then run. and you can check for other things as well. I have not done much with animations just yet. but if you are having trouble still by the 12th. let me know, My development team will be finishing a rough cut of our game getting it ready for Alpha this month. Our last goal is getting animations.