Your enthusiasm is awesome, but asking for someone to walk you through how to make a game is a bit broad for a single forum topic. I'm just going to briefly address your question about animated sprites.
As a prelude to that, I should mention that if you are not familiar with the concept of Object-Oriented programming, I'd suggest you read through these tutorials:
http://java.sun.com/docs/books/tutorial/java/index.html
Processing has a class called
PImage that makes it easy to load an image you've placed in your sketches "data" folder and then display it on the screen by specifying where you want the left corner to be. You might do something like:
Code:
PImage myImage = loadImage("foo.jpg");
image(myImage, 0, 0);
If you want an animated sprite, you could create a class that references all the images needed for the animation and then keeps track of which one it should draw every time you ask it to draw. This class could also keep track of its position so that you didn't have to specify exactly where to draw the sprite every frame (if it's stationary, for example). You don't *need* to create a class to accomplish this, but collecting related data and behaviour into a single class (called encapsulating that data/behaviour) is what using an object-oriented language like Processing (ie Java) is all about. Here's a class that would create something like an animated gif (I haven't tested this, I'm just riffing it into the message box):
Code:
class AnimatedSprite
{
private PImage[] frames;
private int currFrame;
private float frameLength;
private int timer;
private float x, y;
AnimatedSprite(PImage[] f, float fps)
{
frames = f;
frameLength = 1000/fps; // set frameLength in milliseconds
currFrame = 0;
timer = millis();
x = 0;
y = 0;
}
void setPosition(float px, float py)
{
x = px;
y = py;
}
void draw()
{
if ( millis() - timer > frameLength )
{
currFrame += 1;
// this sets the current frame to 0
// if we've reached the end of the frame array
currFrame %= frames.length;
// this resets the timer
timer = millis();
}
image(frames[currFrame], x, y);
}
}
So in your main draw() loop you might have an instance of this class called spinner. When you want it to display you type:
spinner.draw();
If you need to reposition it, you type:
spinner.setPosition(x, y);
Where x and y are floats that have values stored in them.