Hi ive decided to make an applet where i would like my favorite player ed reed to run accross the screen with the ball in his hand, and i was wondering how i can animate him to do that..ive used the repaint function with a try sleep before so thats all i really am not sure how to do.. what would be a base code for this? im sure its hard if sice you dont have the file, but mabye you can give me a little back round
thanks
thanks
Code:
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import javax.swing.*;
public class applet311 extends JApplet
{
Thread t = new Thread();;
Image image; //an 'Image' object
public void init()
{
image = getImage(getCodeBase(), "EdReed_large.gif");
}
public void paint(Graphics g)
{
g.setColor(Color.green);
g.fillRect(0,0,500,500);
for( int a=0;a<=1000;a+=10)
{
g.setColor(Color.white);
g.drawLine(0,10+a,500,10+a);
g.drawImage(image, 400, 0, this);
}
}
Comment