如何从文本中输出的数组中放入随机图像

时间:2016-06-07 22:36:53

标签: java arrays image

如何将其作为随机图像并从数组中获取并显示在程序中?

此程序应在背景设置上显示此图片。

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();

}

0 个答案:

没有答案