I was trying to locate a sprite-sheet using this code. I tried for like 3 days but i can't really find the problem. ¿Can anyone tell me where is the error?
public class HojaSprites {
public final int[] pixeles;
private final int alto;
private final int ancho;
//colección de hojas de sprites
public static HojaSprites SPACE = new HojaSprites("/assets/spaceships.png", 192, 192); //192 x 192
//fin de colección
public HojaSprites(final String ruta, final int ancho, final int alto){
this.ancho=ancho;
this.alto=alto;
pixeles= new int[ancho*alto];
BufferedImage imagen;
try{
imagen = ImageIO.read(HojaSprites.class.getResource(ruta));
imagen.getRGB(0,0,ancho,alto,pixeles,0,ancho);}
catch (IOException e) {}
}
public int getAncho(){
return ancho;
}
public int getAlto(){
return alto;
}
}
I still getting this errors. May it even be an another class problem?