0
我正在使用基于文本的RPG,并在处理该错误时遇到此错误。编译错误:不是语句
package game;
import java.awt.image.BufferedImage;
import java.awt.image.DataBufferInt;
/**
*
* @author Pyro
*/
public class SpriteSheetLoader {
public int[] sheetPixels;
public int[] pixels;
int x, y, sheetWidth;
public SpriteSheetLoader(BufferedImage sheet){
BufferedImage image = new BufferedImage(sheet.getWidth(), sheet.getHeight(), BufferedImage.TYPE_INT_ARGB);
image.getGraphics().drawImage(sheet, 0, 0, null);
sheetPixels = ((DataBufferInt)image.getRaster().getDataBuffer()).getData();
sheetWidth = sheet.getWidth();
}
public void grabTile(int tile, int width, int height) {
sheetPixels = new int[width * height];
int xTile = tile % 16;
int yTile = tile % 16;
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
int value = pixels[(x + (y * width))] * sheetPixels[((x + (xTile * width)) + (y + (yTile * height)) * sheetWidth)];
}
}
}
}
错误周围七号线出现了,我似乎无法找出
显示的错误是什么?我没有看到在这段代码中定义的'sheetPixels','pixels'或'sheetWidth',所以我不能告诉你这些是否有问题。 – mkobit 2014-09-22 23:58:18
这是说,第七行不是一个声明 – Pyrosix 2014-09-22 23:59:02
该行没有任务。看起来你只是在计算一个值。 – 2014-09-22 23:59:37