Here’s a snippet of the Graphics launch of my program (After the applets prepped) loading the Animation Frames + Transparent Images, i’ll post all the code so you can see / count O.o.
(Counted: 17) XD
public GraphicsClass(Game game) {
texture = new TextureLoader(this);
tploader = new TransparentLoader();
p = Client.p;
GraphicsClass.gam = game;
try {
TransparentLoader.makeTransparents();
loadFireImages1();
loadFireImages2();
} catch (Exception e) {
e.printStackTrace();
}
}
Than calls to load the fireImages (1,2):
public static void loadFireImages1() {
tempImg = new ImageIcon("res/icons/fire1.png").getImage();
fireFrames1[0] = tempImg;
tempImg = new ImageIcon("res/icons/fire1.png").getImage();
fireFrames1[1] = tempImg;
tempImg = new ImageIcon("res/icons/fire2.png").getImage();
fireFrames1[2] = tempImg;
tempImg = new ImageIcon("res/icons/fire2.png").getImage();
fireFrames1[3] = tempImg;
tempImg = new ImageIcon("res/icons/fire3.png").getImage();
fireFrames1[4] = tempImg;
tempImg = new ImageIcon("res/icons/fire3.png").getImage();
fireFrames1[5] = tempImg;
}
public static void loadFireImages2() {
tempImg = TransparentLoader.fireIcon1;
fireFrames2[0] = tempImg;
tempImg = TransparentLoader.fireIcon1;
fireFrames2[1] = tempImg;
tempImg = TransparentLoader.fireIcon2;
fireFrames2[2] = tempImg;
tempImg = TransparentLoader.fireIcon2;
fireFrames2[3] = tempImg;
tempImg = TransparentLoader.fireIcon3;
fireFrames2[4] = tempImg;
tempImg = TransparentLoader.fireIcon3;
fireFrames2[5] = tempImg;
}
And finally loading the Transparent Images:
public static void makeTransparents() throws Exception {
try {
BufferedImage tmp0 = ImageIO.read(new File( "res/sprites/southwall.png"));
BufferedImage tmp1 = ImageIO.read(new File( "res/sprites/eastwall.png"));
BufferedImage tmp2 = ImageIO.read(new File("res/icons/fire1.png"));
BufferedImage tmp3 = ImageIO.read(new File("res/icons/fire2.png"));
BufferedImage tmp4 = ImageIO.read(new File("res/icons/fire3.png"));
southWall = makeTransparent(tmp0);
eastWall = makeTransparent(tmp1);
fireIcon1 = makeTransparent(tmp2);
fireIcon2 = makeTransparent(tmp3);
fireIcon3 = makeTransparent(tmp4);
} catch (FileNotFoundException e3) {
System.out.println("File not found.");
e3.printStackTrace();
}
}
My game’s completely loaded, start screen, input handlers active etc in under 3 seconds.
(Honestly if I dugg around in my Game Classes i’d probably find a good 7+ more images)