Hello All,
I am trying to get my character to move and animate at the same time. I wrote a simple method to build a KeyInputListener. I have implemented the animation which works quite well. Now, I have no idea on how to move my character without the KeyNodeForwardAction and KeyBindingManager "way" (which is the same way FlagRush handles input and translations) Could someone point me in the right direction?
Here is my buildInput() method:
private void buildInput()
{
input = KeyInput.get();
input.addListener
( new KeyInputListener() {
public void onKey( char character, int keyCode, boolean pressed )
{
if(pressed == false)
{
playerAnimationControl.setRepeatType(JointController.RT_WRAP);
playerAnimationControl.setActive(true);
playerAnimationControl.setTimes(292, 325);
playerAnimationControl.setSpeed(.2f);
}
if(character == 'w')
{
playerAnimationControl.setRepeatType(JointController.RT_WRAP);
playerAnimationControl.setActive(true);
playerAnimationControl.setTimes(16, 26);
playerAnimationControl.setSpeed(.5f);
// CODE TO MOVE FORWARD
}
}
}
);
}