這真的很奇怪,錯誤在textures[x]
。表達式的類型必須是數組類型,但它解析爲BufferedImage
The type of the expression must be an array type but it resolved to BufferedImage
這裏的代碼有什麼問題?
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();
}
}
哦謝謝,我很笨:p –