It’s being really weird, the error is at textures[x].
The type of the expression must be an array type but it resolved to BufferedImage
What is wrong with the code here?
static BufferedImage textures[][] = new BufferedImage[20][20];
public static void loadTextures()
{
try
{
//Loads The Image
BufferedImage textures = ImageIO.read(new URL("textures.png"));
for (int x = 0; x < 1280; x += 1)
{
for (int y = 0; y < 1280; y += 1)
{
textures[x][y] = textures.getSubimage(x*64, y*64, 64, 64);
}
}
} catch (Exception e)
{
e.printStackTrace();
}
}
You are reusing the name that you gave to your array for the image that you are planning to parcel into individual elements. You should give it a different name to make it work: