How do you choose a specific stored set of aarrays instead of all of them? Help please
in
Programming Questions
•
1 year ago
hey guys, ok so first off I have an array displaying 4 images
ex:
imageHeads[0] = loadImage("tiger_head.png");
imageHeads[1] = loadImage("bear_head.png");
imageHeads[2] = loadImage("giraffe_head.png");
imageHeads[1] = loadImage("bear_head.png");
imageHeads[2] = loadImage("giraffe_head.png");
imageHeads[3] = loadImage("monkey_head.png");
now to display only one array at a time I use:
randIndexhead = int(random(0, heads.length));
and to choose to a random array I use this:
heads[randIndex].draw();
Now all of it works, the function calls a random image from my array and displays it once. My question is:
Is there a way to make it so I can call only a few images instead all of them. For example can I make it so it randomly chooses between image 0 and 3 instead of all of them.
Let me know thanks alot for the help
1