Character Animation

Hey Guys, i'am here again to ask your help.

I have the animation of the character walking and stopped, when i'am not walking how i can automatic call the animation "stopped"? Now i'am using a button to call this animation.

Somebody can help me? Thanks

I suggest you have one field that keeps the state of the character (e.g. boolean moving=false)



In the update you could then have something like this:


public void update(...)
{
    boolean keypressed=false;
    if (key.isValidCommand("..."))
    {
         keypressed = true;
         if (moving==false)
         {
             moving = true;
             playWalkingAnimation(...);
         }
    }
   
     // no keypressed in this cycle but animation walk still running
     if (keypressed==false && moving==true)
     {
          moving = false;
          stopAnimation();
     }
}



Something like this....hope that helped...