1

How do I make it that random images and taken from the array and displayed on the program?

This program is supposed to display this picture on the background set.

PImage [] wcArray = new PImage [10]; // This is the array and all of the images that are in the array

wcArray [0] = loadImage ("asdfg0.png"); // These are all of the inputed images in each of the arrays
wcArray [1] = loadImage ("asdfg1.png"); //1
wcArray [2] = loadImage ("asdfg2.png"); //2
wcArray [3] = loadImage ("asdfg3.png"); //3
wcArray [4] = loadImage ("asdfg4.png"); //4
wcArray [5] = loadImage ("asdfg5.png"); //5
wcArray [6] = loadImage ("asdfg6.png"); //6
wcArray [7] = loadImage ("asdfg7.png"); //7
wcArray [8] = loadImage ("asdfg8.png"); //8
wcArray [9] = loadImage ("asdfg9.png"); //9

   pushMatrix(); // This is the actual code that displays the image on the screen from the array
   translate(715,242);
   scale(.56);
   imageMode(CENTER);
   image(wcArray[0], 0, 0); //This displays the actual image from the array on the screen
   imageMode(CORNER);
   popMatrix();

}
Laurel
  • 5,965
  • 14
  • 31
  • 57
sarah_18
  • 11
  • 2
  • You can use a random number to replace `wcArray[0]` instead of 0 you use the random number in range. See how to get one here [generating random number in range](http://stackoverflow.com/questions/363681/generating-random-integers-in-a-specific-range) Also, seems strange that `pushMatrix();` came before the `image(wcArray[0], 0, 0);` – Jorge Campos Jun 07 '16 at 22:48

0 Answers0