Using libgdx, I'm creating a 2D game. I want to load all textures to an array. So I've created a class for them. I'd like to loop the image array within the render()
:
public class LoadingImages {
public Texture[] images;
public area1() {
images[0] = new Texture(Gdx.files.internal("img/image1.jpg"));
}
}
This gives me and error when I try to run it:
Exception in thread "LWJGL Application" java.lang.NullPointerException
at com.mygame.game.LoadingImages.loading(LoadingImages.java:31)
The number of images will be variable depending on the area.