null pointer exception error
in
Programming Questions
•
2 years ago
What is wrong with this code?
int numFrames = 8;
int frame = 0;
PImage[] images = new PImage[numFrames];
void setup(){
size(360,144);
frameRate(30);
images[0] = loadImage("1.png");
}
void draw(){
frame++;
if (frame == numFrames){
frame = 0;
}
image(images[frame],0,0);
}
int numFrames = 8;
int frame = 0;
PImage[] images = new PImage[numFrames];
void setup(){
size(360,144);
frameRate(30);
images[0] = loadImage("1.png");
}
void draw(){
frame++;
if (frame == numFrames){
frame = 0;
}
image(images[frame],0,0);
}
1