OK, with that out of the way:
I'm writing an animation class for my 2D platform game. Basically, all non-static objects will contain an animation object. The animation object has an ArrayList of Images that will be initialized at the creation of the object (parameters will specify file paths/extensions).
What I want to know is how to handle the actual playing of the animation. I have standardized my frame rate already, so I know that what my FPS is and dont need to specify time per frame of animation. What I need to figure out is how to handle the different animations of the game objects. eg. The player is still so it only displays frames 1-5. Then the player hits the left arrow key, so it starts playing the run animation which is frames 6-15. I haven't created an Object/Player/Enemy etc. class yet, so I can build them around this animation, so whatever seems best will get implemented.
Any Help is greatly appreciated,
Thanks
Peter
Oh, and just to clarify, this is the code for my animation class so far:
package platform.game;
import java.awt.*;
import java.awt.Image;
import java.util.ArrayList;
public class Animation {
private ArrayList<Image> frames = new ArrayList<Image>();
private int currentFrame;
public Animation(String path, String ext){
currentFrame = 0;
}
//Returns Current Frame
public Image getFrame(){
return frames.get(currentFrame);
}
}