Accordin to the debug screen the error is in:
1.Line 61: (Class Sprite)
private void load() {
for (int y = 0; y < SIZE; y++) {
for (int x = 0; x < SIZE; x++) {
pixels[x + y * SIZE] = sheet.pixels[(x + this.x) + (y + this.y) * sheet.SIZE]; //Here is the error.
}
}
}
2.Line 43: (Class Sprite)
public Sprite(int size, int x, int y, SpriteSheet sheet) {
SIZE = size;
pixels = new int[SIZE * SIZE];
this.x = x * size;
this.y = y * size;
this.sheet = sheet;
load(); //Here is the error.
}
3. Line 16: (Class Sprite)
public static Sprite spawn_grass = new Sprite(16, 0, 3, SpriteSheet.spawn_level); //Here is the error.
public static Sprite spawn_stone = new Sprite(16, 0, 2, SpriteSheet.spawn_level);
public static Sprite spawn_water = new Sprite(16, 1, 3, SpriteSheet.spawn_level);
public static Sprite spawn_wall = new Sprite(16, 1, 1, SpriteSheet.spawn_level);
public static Sprite spawn_wall2 = new Sprite(16, 1, 2, SpriteSheet.spawn_level);
public static Sprite spawn_floor = new Sprite(16, 0, 0, SpriteSheet.spawn_level);
Line 23: (Class Player)
public Player(int x, int y, Keyboard input) { this.x = x; this.y = y; this.input = input; sprite = Sprite.player_forward; //Here is the error.
}
5.Line 46: (Class Game)
public Game() {
Dimension size = new Dimension(width * scale, height * scale);
setPreferredSize(size);
screen = new Screen(width, height);
frame = new JFrame();
key = new Keyboard();
level = Level.spawn;
player = new Player(16 * 6, 16 * 4, key); //Here is the error.
addKeyListener(key);
}
What can i do? Help!