Game Error (NullPointerException)

in this part of the code where you load the images you skip loading an image into the first array index.

for (int i=1; i<standingImages.length; i++) {
    standingImages[i]=loadImage("link stand"+(i)+".png");
}

you can change this to

for (int i=1; i<standingImages.length; i++) {
    standingImages[i - 1]=loadImage("link stand"+(i)+".png");
}

edit: also your frame count should probably go from 0-5 not 1-6

and as int acts as a floor when you call it on the frame as an index into the image array you can leave those but just change this as well

  if (frame>6) {
    frame=1.0;
  }

to

  if (frame>6) {
    frame=0;
  }
1 Like