Random Image Generator Array
in
Programming Questions
•
1 year ago
I've had a look at the other topics and have followed a few tutorials however im still stuck!
I can't see any images when the script loads up? And not sure where im going wrong any help would be appreciated.
int num = 4;
PImage[] myImageArray = new PImage[num];
void setup () {
size(1300,800);
background(255);
for (int i=0; i<myImageArray.length; i++){
loadImage( "0" + i + ".png");
loadImage( "1" + i + ".png");
loadImage( "2" + i + ".png");
loadImage( "3" + i + ".png");
}
}
void draw() {
image(myImageArray[(int)random(num)],0,0);
}
1