rendered paste bodyimport java.awt.*;
import javax.swing.*;
import javax.imageio.*;
import java.io.*;
public class Sprite extends JPanel
{
private String image;
private int x, y;
Graphics g;
private int current_x = 0;
public Sprite(Graphics _g, String _image, int _x, int _y)
{
g = _g;
image = _image;
x = _x;
y=_y;
try
{
g.drawImage(ImageIO.read(new File(image)), x, y, this);
}
catch (Exception e)
{
e.printStackTrace();
}
}
//change the x-value of the item
void setX()
{
current_x++;
System.out.println("Set X: " + current_x);
repaint();
}
//give the current value of the sprite
int currentX()
{
return x;
//System.out.println("Current X:" + current_x);
}
}