Hey guys i have been java game programming fr a while and i hava had a problem lately. When i load a relatively small sprite sheet in java my FPS goes from 500 to 250 and makes my game pretty laggy. If anyone knew a way to make a java game less laggy and get better FPS, that would be great!
BufferedImage spriteSheet = ImageIO.read(new File(spriteSheetLocation));
sprites = new BufferedImage[rows * columns];
for (int i = 0; i < rows; i++) {
for (int j = 0; j < columns; j++) {
sprites[(i * columns) + j] = spriteSheet.getSubimage(i * width,
j * height, width, height);
}
}