nullpointerexception error
in
Programming Questions
•
2 years ago
Hey I'm new at processing and trying some examples from the book. For some reason this on keeps giving a null pointerexception error. I'm sure it's something very easy to fix I just can't figure it out. Hope someone can help me, Here's the code!
int imageIndex = 0;
PImage [] images = new PImage [maxImages];
void setup () {
size(200, 200);
for (int i = 0; i < images. length; i++) {
images [i] = loadImage ("Ball 1" + i + ".jpg");
}
}
void draw() {
image (images[imageIndex], 0, 0);
}
void mousePressed() {
imageIndex = int(random(images.length));
}
1