Sorry, I should have clarified.
I'm using eclipse to run all my work right now so implementing it into a web browser isn't priority at the moment.
Let me rephrase everything I said, I must have came off confusing.
I created a bullet object.
BULLET OBJECT
import java.awt.BasicStroke;
import java.awt.Graphics2D;
import java.awt.Color;
import java.awt.geom.*;
import java.awt.Rectangle;
public class bullet
{
private int startx;
private int starty;
public bullet(int xstart, int ystart)
{
startx = xstart;
starty = ystart;
}
public void shoot(Graphics2D g2)
{
Rectangle bulletbase = new Rectangle(startx,starty,3,2); //creates the body of the bullet
Ellipse2D.Double bulletnose = new Ellipse2D.Double(startx+2,starty,2,2); //creates the rounded tip of the bullet
g2.setStroke(new BasicStroke(1));
g2.setColor(Color.black);
g2.draw(bulletbase);
g2.draw(bulletnose);
g2.fill(bulletbase);
g2.fill(bulletnose);
g2.setStroke(new BasicStroke(1));
g2.setColor(Color.black);
}
}
This bullet object is the object you see called in the animate class. The bullet displays fine in a test class.
Then in the Animate class when I test it (alone) It displays a bullet shooting a certain distance to the right.
I did this using the Swing Timer and having the ActionListner repaint the bullet at cordinate to the right every 50 ms.
Now here is what I want to do. I plan to make a simple game for my AP Programming class. I created a Stick figure that walked to the right and fired his gun, little bullets would go to the right every few seconds. I noticed however, that once I learned how to use Actions (hit the spacebar) I'd run into a problem. I need to isolate the bullets as new objects so they can occur as frequent or unfrequent as the user wants them too.. So I logically thought... Hey I'll call my Animate class in a test class. When I did nothing happened. I know that there has to be a way, I simply don't know exactly what that way is. I'm probobally ignorant and don't know the format you use when you call an object with a timer already in it. I think its essential to be able to create a bullet object that continues to animate beyond a single frame and can be called often, if I'm gonna implement a health system I'm gonna need seperate objects to do that. Anyways, I hope that clarifies. I do know a little bit about Applets. I created a Monopoly program using only applets, so I know how to draw, color, fill, all the basics to that along with Rectangle, Ellipse, Line, Point and the other objects.... I know that java is object oriented so now I'm trying to learn how to make Objects with Timers and thus animation in them. If there is another way that animates objects, I'll be happy to learn it too. Bear with my ignorance, I'm just trying to learn. Any other suggestions?