Search:

Type: Posts; User: KevinWorkman

Search: Search took 0.10 seconds.

  1. Replies
    13
    Views
    5,540

    Re: Sprite Animation with ArrayLists

    That's because in your keyReleased() method, you call stand(), which I gather sets the animation to the standing animation (or the standing sprite, whatever). You probably want to check which key was...
  2. Replies
    13
    Views
    5,540

    Re: Sprite Animation with ArrayLists

    Well, you set punching and kicking to false when the button is released, so that's going to cause the animation to stop.

    I think what you want to do is force that animation to play the whole way...
  3. Replies
    13
    Views
    5,540

    Re: Sprite Animation with ArrayLists

    The problem is, you don't need a for loop at all. The only time you want to increment the sprite being displayed is in the Timer's ActionListener.
  4. Replies
    13
    Views
    5,540

    Re: Sprite Animation with ArrayLists

    I'm not sure when you're calling that walk() function, but I'm going to assume you're calling it from a KeyListener. Instead of doing that, you want to simply set a boolean from the KeyListener-...
  5. Replies
    13
    Views
    5,540

    Re: Sprite Animation with ArrayLists

    If I were you, I would put the Timer in your top-level game class. I would give it control over everything in the game- each frame, it calls a method of each game object, updating it, doing collision...
  6. Replies
    13
    Views
    5,540

    Re: Sprite Animation with ArrayLists

    The for loop you're using is going to be over and done in a matter of milliseconds (if not faster), so you aren't going to see any of the images, just the last one. You want to introduce a pause in...
  7. Replies
    13
    Views
    5,540

    Re: Sprite Animation with ArrayLists

    I think the gist of what you want to do is have a game loop (probably using a Swing Timer) that constantly updates the game state. Then you could have a KeyListener that determines which animation...
Results 1 to 7 of 7