Just a short little snippet to fix the annoying Sprite loading.
In sprite.java import the following package,
Code:
import javax.swing.ImageIcon;
Now replace your
Code:
public Sprite(String img) {
method with,
Code:
public Sprite(String img) {
try {
Image image = Toolkit.getDefaultToolkit().getImage(location + img + ".png");
ImageIcon icon = new ImageIcon(image);
myWidth = icon.getIconWidth();
myHeight = icon.getIconHeight();
anInt1444 = myWidth;
anInt1445 = myHeight;
anInt1442 = 0;
anInt1443 = 0;
myPixels = new int[myWidth * myHeight];
PixelGrabber pixelgrabber = new PixelGrabber(image, 0, 0, myWidth, myHeight, myPixels, 0, myWidth);
pixelgrabber.grabPixels();
image = null;
} catch(Exception _ex) {
System.out.println(_ex);
}
}
Now you don't have to add each individual sprite.