I tried creating an image array in the setup method, but no matter what I do, the images won’t show up if I try to draw it in the draw method. It works fine in setup but I need to use it in draw. Any suggestions.
void setup() {
size(720, 720);
background(151);
PImage[] tiles = new PImage[5];
tiles[0] = loadImage("C:/Users/sanya/Dropbox/PC/Documents/Processing/Wave function collapse/blank.png");
tiles[1] = loadImage("C:/Users/sanya/Dropbox/PC/Documents/Processing/Wave function collapse/top.png");
tiles[2] = loadImage("C:/Users/sanya/Dropbox/PC/Documents/Processing/Wave function collapse/right.png");
tiles[3] = loadImage("C:/Users/sanya/Dropbox/PC/Documents/Processing/Wave function collapse/bottom.png");
tiles[4] = loadImage("C:/Users/sanya/Dropbox/PC/Documents/Processing/Wave function collapse/left.png");
}
void draw() {
image(tiles[0], 0, 0);
}
The error it displays is that the variable tiles does not exist.