public World(String path) {
try {
BufferedImage map = ImageIO.read(getClass().getResource(path));
int[] pixels = new int[map.getWidth() * map.getWidth()];
WIDTH = map.getWidth();
HEIGHT = map.getHeight();
tiles = new Tile [map.getWidth() * map.getWidth()];
map.getRGB(0, 0, map.getWidth(), map.getHeight(), pixels, 0, map.getWidth());
for(int xx = 0; xx < map.getWidth(); xx++) {
for(int yy = 0; yy < map.getHeight(); yy++) {
int pixelAtual = pixels[xx +(yymap.getWidth())];
tiles[xx + (yyWIDTH)] = new FloorTile(xx16,yy16,Tile.TYLE_FLOOR);
if(pixelAtual == 0xFF000000) {
//Floor/Chão
tiles[xx + (yyWIDTH)] = new FloorTile(xx16,yy16,Tile.TYLE_FLOOR);
} else if(pixelAtual == 0xFFFFFFFF) {
//Wall/Parede
tiles[xx + (yyWIDTH)] = new FloorTile(xx16,yy16,Tile.TYLE_WALL);
} else if(pixelAtual == 0xFF005DFF) {
//Player/Jogador
Game.player.setX(xx16);
Game.player.setY(yy16);
tiles[xx + (yyWIDTH)] = new FloorTile(xx16,yy16,Tile.TYLE_FLOOR);
} else if(pixelAtual == 0xFFFF0000) {
//enemy/Imimigo
Game.entities.add(new Enemy(xx16,yy16,16,16,Entity.ENEMY_EN));
} else if(pixelAtual == 0xFFFFD800) {
//Bullets/Munições
Game.entities.add(new Bullets(xx16,yy16,16,16,Entity.BULLET_EN));
} else if(pixelAtual == 0xFF7FFFFF) {
//Lifepack/vida
Game.entities.add(new Lifepack(xx16,yy16,16,16,Entity.LIFEPACK_EN));
} else if(pixelAtual == 0xFF80006E) {
//Weapon/Arma
Game.entities.add(new Weapon(xx16,yy*16,16,16,Entity.WEAPON_EN));
}
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
public void render(Graphics g) {
int xstart = Camera.x/16;
int ystart = Camera.y/16;
int xfinal = xstart + (Game.WIDTH/16);
int yfinal = ystart + (Game.HEIGHT/16);
for(int xx = xstart; xx <= xfinal; xx++) {
for(int yy = ystart; yy <= yfinal; yy++) {
Tile tile = tiles[xx + (yy*WIDTH)];
tile.render(g);
}
}
}
por algum motivo sem explicação ta dando erro.
at hello_boy/com.gamesfudido.world.World.render(World.java:73)
at hello_boy/com.gamesfudido.main.Game.render(Game.java:93)
at hello_boy/com.gamesfudido.main.Game.run(Game.java:116)
at java.base/java.lang.Thread.run(Thread.java:1583)